Skip to content

Instantly share code, notes, and snippets.

@sean-kang
Created May 15, 2015 03:34
Show Gist options
  • Save sean-kang/3a4845899742d4fb1e7c to your computer and use it in GitHub Desktop.
Save sean-kang/3a4845899742d4fb1e7c to your computer and use it in GitHub Desktop.
Lita wrapper to make it managed by monit
1. service wrapper to generate PID
#!/usr/bin/env bash
PIDFILE=/home/lita/lita/tmp/lita.pid
case $1 in
start)
cd /home/lita/lita ;
echo $$ > ${PIDFILE} ;
exec bundle exec lita start >> /home/lita/lita/log/lita.log 2>&1 ;;
stop)
kill `cat ${PIDFILE}` ;;
*)
echo "usage: $0 {start|stop}" ;;
esac
exit 0
2. monit config (using monit's pid and gid parameters caused path issue.)
check process lita
with pidfile /home/lita/lita/tmp/lita.pid
start program = "/bin/su lita -c '/home/lita/lita/bin/lita start'"
stop program = "/bin/su lita -c '/home/lita/lita/bin/lita stop'"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment