Skip to content

Instantly share code, notes, and snippets.

@masatomo
Created February 16, 2010 03:37
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save masatomo/305259 to your computer and use it in GitHub Desktop.
Save masatomo/305259 to your computer and use it in GitHub Desktop.
#!/bin/sh
# resque wrapper for monit
# see also http://mmonit.com/wiki/Monit/FAQ#pidfile
usage()
{
echo "usage: ${0} {start|stop} <any_process_keyword>"
exit 1
}
if [ ! $# -eq 2 ]; then
usage
fi
pid_file=/usr/local/app/APPLICATION/shared/pids/resque.${2}.pid
log_file=/usr/local/app/APPLICATION/shared/log/resque.${2}.log
case $1 in
start)
echo $$ > ${pid_file}
exec 2>&1 rake resque:work 1> ${log_file}
;;
stop)
kill `cat ${pid_file}`
;;
*)
usage
;;
esac
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment