I recently moved a site from EngineYard to Digital Ocean.
The site used resque mailer to send emails.
So I had to set up resque to handle the queue.
I decided to start it with upstart and added the following script to /etc/init/resque.conf
description "Resque worker configuration" start on runlevel  stop on shutdown respawn respawn limit 5 20 script echo resque Job ran at `date` >> /var/log/resquejob.log cd /path/to/rails_app && bundle exec rake resque:work QUEUE='*' RAILS_ENV=production end script
I can now control the script with
sudo service resque start | stop | restart | status
Remember to replace /path/to/rails_app with the path to your site.
Before starting the service, remember to check the script with
It should yield
File /etc/init/resque.conf: syntax ok
But even if you get an ok back there might still be problems, so that is where the log and status commands comes in handy.
One way to test it is to simply run the command in the terminal.
This script was heavyly inspired by http://jasonroelofs.com/2012/03/12/manage-and-monitor-resque-with-upstart-and-monit/
Image courtesey of https://www.flickr.com/photos/mskogly/