Reputation: 43380
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?
Upvotes: 7
Views: 13093
Reputation: 5926
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
Upvotes: 6
Reputation: 22515
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
Upvotes: 8