additional test configs
[god.git] / test / configs / child_events / child_events.god
blob844ce43750cd3b84c5738238cca24ced12d6fa58
1 God.watch do |w|
2   w.name = "child-events"
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