Skip to content

Instantly share code, notes, and snippets.

@sarogers
Created April 29, 2012 04:11
Show Gist options
  • Save sarogers/2532932 to your computer and use it in GitHub Desktop.
Save sarogers/2532932 to your computer and use it in GitHub Desktop.
Monit script for restarting our Resque workers.
check process resque_worker
with pidfile /home/USER_NAME/dp20/current/tmp/pids/resque_worker.pid
start program = "/usr/bin/env HOME=/home/USER_NAME RACK_ENV=production PATH=/usr/local/bin:/usr/local/ruby/bin:/usr/bin:/bin:$PATH /bin/sh -l -c 'cd /home/USER_NAME/dp20/current; nohup bundle exec rake environment resque:work RAILS_ENV=production QUEUES=record_event,update_counter_cache VERBOSE=1 PIDFILE=tmp/pids/resque_worker.pid & >> log/resque_worker.log 2>&1'" as uid USER_NAME and gid USER_NAME
stop program = "/bin/sh -c 'cd /home/USER_NAME/dp20/current && kill -9 $(cat tmp/pids/resque_worker.pid) && rm -f tmp/pids/resque_worker.pid; exit 0;'"
if totalmem is greater than 300 MB for 10 cycles then restart # eating up memory?
group resque_workers
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment