I use Delayed Job as a queuing backend for Active Job on my Rails 5 app but I have no idea how to start the worker on Ubuntu 14.04 after startup. Should I wrap rails jobs:work
into a Bash script? How would I have it start automatically? Or is it preferable to use bin/delayed_job
?
How do I start delayed job on boot?
It does not really matter what OS you're on (as long it is not Windows :D).
To start the processing the command is:
bundle exec rake jobs:work
to restart the delayed_job the command is:
RAILS_ENV=production script/delayed_job restart
Check out gems README for more info.
(according to the comment)
You can create some bash script in user's home start_delayed_jon.sh
.
Something along the lines:
#!/bin/bash
cd /path/to/your/project/directory/
RAILS_ENV=development bundle exec rake jobs:work
and run it in /etc/rc.local:
su -s /bin/bash - deploy /path/to/your/project/directory/start_delayed_jon.sh
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With