-
-
Save trevorh/299268 to your computer and use it in GitHub Desktop.
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
set :mongrel_rolling_restart_delay, 55 | |
namespace :mongrel do | |
desc <<-DESC | |
Start mongrels in a loop, with a defer of [default] 30 seconds between each single mongrel restart. mongrel_rolling_restart_delay can be set to override the default. | |
DESC | |
task :rolling_restart, :roles => [:app], :except => {:mongrel => false} do | |
set(:restart_delay) { fetch(:mongrel_rolling_restart_delay, 30) } | |
run %{ | |
for mongrel in $(#{sudo} monit summary | grep -o -E mongrel_#{monit_group}_[0-9]+); \ | |
do \ | |
echo "Executing monit restart ${mongrel}"; \ | |
#{sudo} /usr/bin/monit restart ${mongrel}; \ | |
echo "sleeping #{restart_delay}"; \ | |
sleep #{restart_delay}; \ | |
done | |
} | |
puts "Done." | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment