2 w.name = "daemon-events"
4 w.start = 'ruby ' + File.join(File.dirname(__FILE__), *%w[simple_server.rb]) + ' start'
5 w.stop = 'ruby ' + File.join(File.dirname(__FILE__), *%w[simple_server_stop.rb])
6 w.pid_file = '/var/run/daemon-events.pid'
7 w.log = File.join(File.dirname(__FILE__), 'daemon_events.log')
11 w.behavior(:clean_pid_file)
13 # determine the state on startup
14 w.transition(:init, { true => :up, false => :start }) do |on|
15 on.condition(:process_running) do |c|
20 # determine when process has finished starting
21 w.transition([:start, :restart], :up) do |on|
22 on.condition(:process_running) do |c|
27 on.condition(:tries) do |c|
33 # start if process is not running
34 w.transition(:up, :start) do |on|
35 on.condition(:process_exits)