Skip to content

Instantly share code, notes, and snippets.

@jnillo
Last active August 29, 2015 14:12
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 jnillo/d26962798f6cded9bf8c to your computer and use it in GitHub Desktop.
Save jnillo/d26962798f6cded9bf8c to your computer and use it in GitHub Desktop.
Task to check status of your Sidekiq process
namespace :check_services do
task :sidekiq => :environment do
path = "path/to/file.pid"
pid=File.open(path,'r').read.gsub("\n",'')
result = IO.popen("ps aux | grep sidekiq").gets.include?(pid)
unless result
system "command_to_run_your_sidekiq" # For Example: bundle exec sidekiq -C config/sidekiq.yml
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment