Ruby-on-rails – Rails: How to restart sidekiq

rubyruby-on-railsruby-on-rails-3sidekiq

I am using sidekiq gem to run API calls in background. I ran sidekiq in Daemon process like:

  bundle exec sidekiq -d

Now I made some changes in my method, so I want to restart sidekiq. I tried to kill the sidekiq by using the below command:

  kill -9 process_id 

but it's not working. I want to know the command to restart sidekiq process. If you have any idea please share with me.

I tried the below command also:

 sidekiqctl stop /path/to/pid file/pids/sidekiq.pid

Best Answer

Start:

$ bundle exec sidekiq -d -P tmp/sidekiq.pid -L log/sidekiq.log 

where -d demonize, -P pid file, -L log file.

Stop:

$ bundle exec sidekiqctl stop tmp/sidekiq.pid 0
Sidekiq shut down gracefully.

where 0 is number of seconds to wait until Sidekiq exits.