use 127.0.0.1 for DRb to avoid IPv6 problems
[god.git] / test / configs / child_events / child_events.god
blob40fe1483487cbdf6e4b0dacd7b41b3a08a4285b3
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   
6   # determine the state on startup
7   w.transition(:init, { true => :up, false => :start }) do |on|
8     on.condition(:process_running) do |c|
9       c.running = true
10     end
11   end
12   
13   # determine when process has finished starting
14   w.transition([:start, :restart], :up) do |on|
15     on.condition(:process_running) do |c|
16       c.running = true
17     end
18     
19     # failsafe
20     on.condition(:tries) do |c|
21       c.times = 2
22       c.transition = :start
23     end
24   end
26   # start if process is not running
27   w.transition(:up, :start) do |on|
28     on.condition(:process_exits)
29   end
30 end