add double fork to disown child process
[god.git] / test / configs / events / events.god
blob5ab2104a727bce612c0160a92784fb07693b5d72
1 God.watch do |w|
2   w.name = "simple"
3   w.interval = 5.seconds
4   w.start = File.join(File.dirname(__FILE__), *%w[simple_server.rb])
5   w.stop = ""
6   
7   # determine the state on startup
8   w.transition(:init, { true => :up, false => :start }) do |on|
9     on.condition(:process_running) do |c|
10       c.running = true
11     end
12   end
13   
14   # determine when process has finished starting
15   w.transition(:start, :up) do |on|
16     on.condition(:process_running) do |c|
17       c.running = true
18     end
19   end
21   # start if process is not running
22   w.transition(:up, :start) do |on|
23     on.condition(:process_exits)
24   end
25 end