public
Created — forked from guilherme/resque_web.monit

monit configuration for resque web

  • Download Gist
resque_web.monit
1 2 3 4 5 6
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
run_resque_web.sh
Shell
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
#!/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

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.