Setup resque mailer on Ubuntu 14.04

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 [2345]
stop on shutdown

respawn limit 5 20

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

 init-checkconf /etc/init/resque.conf

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

Image courtesey of

comments powered by Disqus