我有下面的上帝配置文件。
我有几个问题,你能帮我吗:
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发布于 2014-07-11 09:20:44
对于问题1,我不知道w.interval =10.seconds,我在它的官方文档中没有看到这种用法。代码段仅在start_if段范围内受影响。
# but unfortunately, this doesn't work for me.
God.watch do |w|
w.name = 'keepalive'
# ...
w.keepalive(:interval => 60.seconds)
endhttps://stackoverflow.com/questions/20794537
复制相似问题