Sha256: 3f9d3dbe39b5adea5553934c6f02ed606e466de3585b86327461cc74bc2a1fd7

Contents?: true

Size: 997 Bytes

Versions: 69

Compression:

Stored size: 997 Bytes

Contents

God.watch do |w|
  w.name = "daemon-events"
  w.interval = 5.seconds
  w.start = 'ruby ' + File.join(File.dirname(__FILE__), *%w[simple_server.rb]) + ' start'
  w.stop = 'ruby ' + File.join(File.dirname(__FILE__), *%w[simple_server_stop.rb])
  w.pid_file = '/var/run/daemon-events.pid'
  w.log = File.join(File.dirname(__FILE__), 'daemon_events.log')
  w.uid = 'tom'
  w.gid = 'tom'
  
  w.behavior(:clean_pid_file)
  
  # determine the state on startup
  w.transition(:init, { true => :up, false => :start }) do |on|
    on.condition(:process_running) do |c|
      c.running = true
    end
  end
  
  # determine when process has finished starting
  w.transition([:start, :restart], :up) do |on|
    on.condition(:process_running) do |c|
      c.running = true
    end
    
    # failsafe
    on.condition(:tries) do |c|
      c.times = 2
      c.transition = :start
    end
  end

  # start if process is not running
  w.transition(:up, :start) do |on|
    on.condition(:process_exits)
  end
end

Version data entries

69 entries across 69 versions & 21 rubygems

Version Path
dguettler-god-0.7.13.2 test/configs/daemon_events/daemon_events.god
dguettler-god-0.7.13.3 test/configs/daemon_events/daemon_events.god
dosire-god-0.7.10 test/configs/daemon_events/daemon_events.god
dosire-god-0.7.12 test/configs/daemon_events/daemon_events.god
dosire-god-0.7.9 test/configs/daemon_events/daemon_events.god
dunedain289-god-0.7.12.1 test/configs/daemon_events/daemon_events.god
dustin-god-0.7.7.1 test/configs/daemon_events/daemon_events.god
eric-god-0.7.10 test/configs/daemon_events/daemon_events.god
eric-god-0.7.11 test/configs/daemon_events/daemon_events.god
eric-god-0.7.12 test/configs/daemon_events/daemon_events.god
eric-god-0.7.14 test/configs/daemon_events/daemon_events.god
eric-god-0.7.7 test/configs/daemon_events/daemon_events.god
fotonauts-god-0.7.10 test/configs/daemon_events/daemon_events.god
fotonauts-god-0.7.12 test/configs/daemon_events/daemon_events.god
gohanlonllc-god-0.7.9 test/configs/daemon_events/daemon_events.god
gordoncww-god-0.7.11.1 test/configs/daemon_events/daemon_events.god
jreynolds-god-0.7.13 test/configs/daemon_events/daemon_events.god
jwilkins-god-0.7.9 test/configs/daemon_events/daemon_events.god
mathieuravaux-god-0.7.11 test/configs/daemon_events/daemon_events.god
mojombo-god-0.7.10 test/configs/daemon_events/daemon_events.god