Created
April 12, 2010 13:30
-
-
Save sunkencity/363553 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
namespace :delayed_job do | |
task :ensure, :roles => :app do | |
pid_from_file = capture("cat #{current_path}/tmp/pids/delayed_job.pid").strip | |
running_pids = capture("ps -ef | grep [d]elayed_job").split("\n").map { |x| x.split[1] } | |
if pid_from_file != running_pids.first || running_pids.size != 1 | |
puts ("-"*80).console_purple | |
puts "Something is terribly wrong with delayed job!".console_red | |
puts "Running_pid: #{pid_from_file}" | |
puts "Running delayed job processes: #{capture("ps -ef | grep [d]elayed_job")}" | |
puts ("-"*80).console_purple | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
console coloring courtesy of http://snippets.dzone.com/posts/show/7148