Question: How to start Delayed Job with Ubuntu?

Question

How to start Delayed Job with Ubuntu?

Answers 1
Added at 2016-09-27 10:09
Tags
Question

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?

Answers
nr: #1 dodano: 2016-09-27 10:09

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.

EDIT

(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
Source Show
◀ Wstecz