Skip to content

Instantly share code, notes, and snippets.

@joker1007
Created November 14, 2011 14:10
Show Gist options
  • Save joker1007/1364017 to your computer and use it in GitHub Desktop.
Save joker1007/1364017 to your computer and use it in GitHub Desktop.
check process unicorn with pidfile "/var/www/rails_apps/pasokara_player/shared/pids/unicorn.pid"
start program = "/bin/su - joker bash -c '. /home/joker/.rvm/scripts/rvm; cd /var/www/rails_apps/pasokara_player/current; bundle exec unicorn_rails -D -E production -p 8000'"
with timeout 20 seconds
stop program = "/bin/su - joker bash -c '/bin/kill -QUIT `/bin/cat /var/www/rails_apps/pasokara_player/shared/pids/unicorn.pid`'"
if totalmem > 500 MB for 2 cycles
then exec "/bin/kill -HUP `/bin/cat /var/www/rails_apps/pasokara_player/shared/pids/unicorn.pid`"
if 2 restarts within 3 cycles then timeout
if cpu usage > 95% for 3 cycles then restart
# vim:ft=monitrc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment