Q:

How to start Delayed Job with Ubuntu?

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?

A:

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

A:

Using the Whenever Gem, you can setup a cronjob that runs it on reboot. In your schedule.rb file:
every :reboot do
 rake 'start_delayed_jobs'
end

Then in your rake file:
desc 'Start delayed jobs'
  task :start_delayed_jobs do
    system("#{Rails.root}/bin/delayed_job start")
  end
end

