Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
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