Create a gist now

Instantly share code, notes, and snippets.

Embed
What would you like to do?
God's delayed start example
# -*- mode: ruby -*-
God.watch do |w|
w.name = 'wig.rb'
w.interval = 5.seconds
w.start = 'wig.rb -h 127.0.0.1'
# delay wig.rb
w.autostart = false
w.behavior( :clean_pid_file )
w.start_if do |start|
start.condition( :process_running ) do |c|
c.running = false
end
end
end
God.watch do |w|
w.name = 'tig.rb'
w.interval = 5.seconds
w.start = 'tig.rb -h 127.0.0.1'
w.behavior( :clean_pid_file )
w.start_if do |start|
start.condition( :process_running ) do |c|
c.running = false
end
end
end
Thread.new {
while ( God.status['tig.rb'][:state] != :up )
;
end
God.control( 'wig.rb', 'start' )
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment