Sha256: 8c8c0377de51924cef4c7c28cf62816a12ea2952f79042a29b2c464a6d054857

Contents?: true

Size: 718 Bytes

Versions: 3

Compression:

Stored size: 718 Bytes

Contents

God.watch do |w|
  w.name = "child-events"
  w.interval = 5.seconds
  w.start = File.join(File.dirname(__FILE__), *%w[simple_server.rb])
  
  # 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

3 entries across 3 versions & 1 rubygems

Version Path
god-0.4.1 test/configs/child_events/child_events.god
god-0.4.3 test/configs/child_events/child_events.god
god-0.4.0 test/configs/child_events/child_events.god