Last active
April 16, 2020 08:22
-
-
Save vishalzambre/bedae6fa18457ac406a67aeba8129b35 to your computer and use it in GitHub Desktop.
System Service for resque
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
## Add System Service for Resque | |
Copy below code and paste to /lib/systemd/system/resque.service | |
`vim /lib/systemd/system/resque.service` | |
```shell | |
[Unit] | |
Description=Resque Workers | |
[Service] | |
WorkingDirectory=/var/app/current | |
ExecStop=-/sbin/start-stop-daemon --quiet --stop --retry QUIT/5 --pidfile /var/run/resque_worker.pid | |
PIDFile=/var/run/resque_worker.pid | |
ExecStart=/usr/local/rbenv/bin/rbenv exec bundle exec rake resque:jobs:content & | |
Environment=RBENV_ROOT=/usr/local/rbenv | |
Environment=RBENV_VERSION=2.4.4 | |
Environment=RAILS_ENV=production | |
TimeoutStopSec=0 | |
Restart=always | |
User=www-data | |
Group=www-data | |
[Install] | |
WantedBy=multi-user.target | |
Alias=resque.service | |
``` | |
Link Service | |
`ln -s /lib/systemd/system/resque.service /etc/systemd/system/resque.service` | |
Enable Service | |
`systemctl enable resque.service ` | |
Reload daemon | |
`systemctl daemon-reload` | |
Start | |
`systemctl start resque.service` | |
Stop | |
`systemctl stop resque.service` | |
Status | |
`systemctl status resque.service` | |
To Remove unregistered workers | |
`Resque.workers.each {|w| w.unregister_worker}` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment