Skip to content

Instantly share code, notes, and snippets.

@guilherme
Created March 22, 2011 19:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save guilherme/881873 to your computer and use it in GitHub Desktop.
Save guilherme/881873 to your computer and use it in GitHub Desktop.
monit configuration for resque web
check process resque-web with pidfile /var/www/app/shared/resque_web/resque_web.pid
group resque
start program = "/bin/env RAILS_ENV=production /var/www/app/current/app/workers/run_resque_web.sh start" as uid deploy gid deploy
stop program = "/bin/env RAILS_ENV=production /var/www/app/current/app/workers/run_resque_web.sh stop" as uid deploy and gid deploy
if failed host localhost port 5678 with timeout 10 seconds then restart
if 3 restarts within 5 cycles then timeout
#!/bin/bash
export APP_ROOT=/var/www/app/current
export RESQUE_WEB_ROOT=/var/www/app/shared/resque_web
export HOME=/home/deploy
export PATH=$PATH:/opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/bin
export PORT=5678
if [[ -z $RAILS_ENV ]]
then
echo "SETTING RAILS_ENV AS development"
RAILS_ENV=development
fi
case $1 in
start)
/usr/bin/ruby /usr/bin/resque-web --app-dir $RESQUE_WEB_ROOT -e $RAILS_ENV $APP_ROOT/config/initializers/resque.rb -p $PORT
;;
stop)
/usr/bin/ruby /usr/bin/resque-web --app-dir $RESQUE_WEB_ROOT -e $RAILS_ENV $APP_ROOT/config/initializers/resque.rb -p $PORT -K
;;
*)
echo "usage: RAILS_ENV=environment run_resque_web.sh {start|stop}" ;;
esac
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment