Skip to content

Instantly share code, notes, and snippets.

@denmarkin
Created March 11, 2011 19:31
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save denmarkin/866427 to your computer and use it in GitHub Desktop.
Save denmarkin/866427 to your computer and use it in GitHub Desktop.
real-world monit recipes
# See: http://stackoverflow.com/questions/1226302/how-to-monitor-delayedjob-with-monit/1285611
check process delayed_job with pidfile /full/path/to/app/shared/pids/delayed_job.pid
start program = "/bin/su - deploy_username -c 'cd /full/path/to/app/current/; RAILS_ENV=production script/delayed_job start'"
stop program = "/bin/su - deploy_username -c 'cd /full/path/to/app/current/; RAILS_ENV=production script/delayed_job stop'"
# Replace hostname in pid name
check process mysql with pidfile /var/lib/mysql/hostname.pid
start program = "/etc/init.d/mysql start"
stop program = "/etc/init.d/mysql stop"
# If you want to use nginx + passenger, I would suggest to install package first, then delete it.
# This action will give you init.d script.
# Then simply install passenger and allow it to compile nginx for you.
# Correct the paths in /etc/init.d/nginx script, and you're good to go.
check process nginx with pidfile /var/run/nginx.pid
start program = "/etc/init.d/nginx start"
stop program = "/etc/init.d/nginx stop"
# Replace path to app and deploy_username
check process thinking_sphinx with pidfile /full/path/to/app/current/log/searchd.production.pid
start program = "/bin/su - deploy_username -c 'cd /full/path/to/app/current/; rake RAILS_ENV=production ts:start'"
stop program = "/bin/su - deploy_username -c 'cd /full/path/to/app/current/; rake RAILS_ENV=production ts:stop'"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment