Created
January 19, 2010 02:02
-
-
Save wtnabe/280586 to your computer and use it in GitHub Desktop.
God's delayed start example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- 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