上帝配置与keepalive和间隔

时间:2013-12-27 03:59:50

标签: god

我有以下配置文件。

在这里,我有几个问题,请你帮助我:

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

1 个答案:

答案 0 :(得分: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