Skip to content

Instantly share code, notes, and snippets.

@wtnabe
Created January 19, 2010 02:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wtnabe/280586 to your computer and use it in GitHub Desktop.
Save wtnabe/280586 to your computer and use it in GitHub Desktop.
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