Last active
August 29, 2015 14:12
-
-
Save jnillo/d26962798f6cded9bf8c to your computer and use it in GitHub Desktop.
Task to check status of your Sidekiq process
This file contains hidden or 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 :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