-
-
Save xdougx/11378848 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Thanks to Jason Roelofs for his article at http://jasonroelofs.com/2012/03/12/manage-and-monitor-resque-with-upstart-and-monit/ which got me most of the way there. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
description "Start a Resque worker by supplying an ID. For example: start resque ID=1. See also: resque-workers.conf" | |
respawn | |
respawn limit 5 20 | |
instance $ID | |
script | |
APP_PATH=/apps/my_app/current | |
PIDFILE=$APP_PATH/tmp/pids/resque-$ID.pid | |
LOGFILE=$APP_PATH/log/resque_workers.log | |
su -c "cd $APP_PATH; bundle exec rake resque:work QUEUE=* PIDFILE=$PIDFILE RAILS_ENV=production >> $LOGFILE 2>&1" - my_user | |
end script |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
description "Start multiple Resque workers. Change NUM_WORKERS based on your needs." | |
start on (local-filesystems and net-device-up IFACE=eth0) | |
task | |
env NUM_WORKERS=5 | |
script | |
for i in `seq 1 $NUM_WORKERS` | |
do | |
start resque-worker ID=$i | |
done | |
end script |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment