Skip to content

Instantly share code, notes, and snippets.

@sunkencity
Created April 12, 2010 13:30
Show Gist options
  • Save sunkencity/363553 to your computer and use it in GitHub Desktop.
Save sunkencity/363553 to your computer and use it in GitHub Desktop.
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
@sunkencity
Copy link
Author

console coloring courtesy of http://snippets.dzone.com/posts/show/7148

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment