Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rails: How to restart sidekiq?

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 
like image 556
Can Can Avatar asked Jun 27 '14 07:06

Can Can


People also ask

How do I start sidekiq Rails?

To run sidekiq, you will need to open a terminal, navigate to your application's directory, and start the sidekiq process, exactly as you would start a web server for the application itself. When the command executes you will see a message that sidekiq has started.

How do I stop sidekiq?

The only consistent fix I've found is rebooting. kill 'process_id' worked fine, to kill the process. Though then restarting sidekiq it can't find redis. Moreover, 'kill -term pid' will cause it to shut down as gracefully as it can in the next 10 seconds.


1 Answers

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.

like image 116
Artem P Avatar answered Sep 17 '22 15:09

Artem P