Sha256: 5269dcb5a4102431ef8ee6ec7bf6419f0b2b8cb538dd0133010d2b4e6363c9d0

Contents?: true

Size: 988 Bytes

Versions: 12

Compression:

Stored size: 988 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

12 entries across 12 versions & 3 rubygems

Version Path
resurrected_god-0.14.0 test/configs/daemon_events/daemon_events.god
mcproc-2016.2.20 test/configs/daemon_events/daemon_events.god
god-0.13.7 test/configs/daemon_events/daemon_events.god
god-0.13.6 test/configs/daemon_events/daemon_events.god
god-0.13.5 test/configs/daemon_events/daemon_events.god
god-0.13.4 test/configs/daemon_events/daemon_events.god
god-0.13.3 test/configs/daemon_events/daemon_events.god
god-0.13.2 test/configs/daemon_events/daemon_events.god
god-0.13.1 test/configs/daemon_events/daemon_events.god
god-0.13.0 test/configs/daemon_events/daemon_events.god
god-0.12.1 test/configs/daemon_events/daemon_events.god
god-0.12.0 test/configs/daemon_events/daemon_events.god