1

我有以下上帝配置文件。

在这里我有几个问题,你能帮我吗:

1 - w.interval 和 c.interval 会做什么?

2 - 我想让我的守护进程保持活动状态(w.keepalive),如何将它添加到我的代码中?这里还有一件事是当它调用keepalive时我想睡60秒左右然后开始,有可能吗?

DIR = "/home/guest/god"
God.pid_file_directory = DIR
God.watch do |w|
    w.name          =       "Test"
    w.start         =       "sh /home/guest/god/test.sh"
    w.pid_file      =       File.join(DIR, 'test.pid')
    w.behavior(:clean_pid_file)
    w.interval      =       10.seconds
    w.start_if do |start|
            start.condition(:process_running) do |c|
                    puts "Inside start condition"
                    c.interval      =       5.seconds
                    c.running       =       false
            end
    end
end
4

1 回答 1

0

对于问题1,我不知道w.interval =10.seconds,我在其官方文档中没有看到这种用法。该代码c.interval = 5.seconds将仅在start_if段范围内产生影响。

对于问题 2,请参阅此示例:(https://github.com/mojombo/god/blob/master/test/configs/keepalive/keepalive.god

# but unfortunately, this doesn't work for me.
God.watch do |w|
  w.name = 'keepalive'
  # ...
  w.keepalive(:interval => 60.seconds)

end
于 2014-07-11T01:20:43.517 回答