Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Sidekiq Doesn't Create a PID file

In order to stop Sidekiq I need to use:

$bundle exec sidekiqctl stop /Users/me/Documents/sites/some_site/tmp/pid/sidekiq.pid 20

I am telling Sidekiq to create a pid file in a config.yml file:

#/Users/me/Documents/sites/some_site/config.yml
:pidfile: /Users/me/Documents/sites/some_site/tmp/pids/sidekiq.pid
:concurrency: 25

And telling Sidekiq where this config file is using:

$ bundle exec sidekiq -C /Users/me/Documents/sites/some_site/config.yml

However when I run Sidekiq it does not create a .pid file, so I can't stop it. So why doesn't it create a .pid file?

like image 357
Undistraction Avatar asked Jan 16 '13 11:01

Undistraction


2 Answers

Try replacing that absolute path with this:

:pidfile: ./tmp/pids/sidekiq.pid

Second, ensure the user that will run sidekiq has the proper write permissions to write to that directory. You can chmod 777 temporarily to test to see if permissions is the issue.

Here is an example config yml file for Sidekiq. Make sure you specify a queue too. https://github.com/mperham/sidekiq/blob/master/examples/config.yml

like image 200
Henley Avatar answered Oct 21 '22 17:10

Henley


To use a pidfile, you should launch sidekiq as a daemon. When on your rails root directory launch sidekiq with this command :

bundle exec sidekiq -d -e development

You can replace development by the appropriate rails environment.

You should also specify a logfile in you sikekiq configure (config/sidekiq.yml). Exemple :

concurrency: 5
development:
  pidfile: tmp/pids/sidekiq_development.pid
  logfile: log/sidekiq_development.log
beta:
  pidfile: /var/run/sidekiq_beta.log
  logfile: log/sidekiq_beta.pid
staging:
  pidfile: /var/run/sidekiq_stating.pid
  logfile: log/sidekiq_staging.log
production:
  pidfile: /var/run/sidekiq_production.pid
  logfile: log/sidekiq_production.log
  concurrency: 50

If you are on Debian and you need a launch script, you can use this Gist, I put, on Github : https://gist.github.com/alain75007/5517948

like image 26
Alain Beauvois Avatar answered Oct 21 '22 17:10

Alain Beauvois