Created
July 31, 2016 19:28
-
-
Save ekilah/220f87a5975bb25d2be8e4fa20aa6a13 to your computer and use it in GitHub Desktop.
monit wrapper script to start a non-daemonized process like lita
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
check process lita with pidfile /usr/local/var/run/lita.pid | |
start program = "/full/path/to/litadaemonscript/litadaemon start" | |
stop program = "/full/path/to/litadaemonscript/litadaemon stop" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
PIDFILE=/usr/local/var/run/lita.pid | |
LOGFILE=/usr/local/var/log/lita.log | |
LITA_PROJECT_DIR=/full/path/to/projectdir/ | |
case $1 in | |
start) | |
cd ${LITA_PROJECT_DIR} | |
rm ${LOGFILE} # optional, remove old logfile | |
exec lita start >> ${LOGFILE} 2>&1 & | |
echo $! > ${PIDFILE} # save spawned backround process' PID to PIDFILE | |
echo "lita started with PID:" | |
cat ${PIDFILE};; | |
stop) | |
kill `cat ${PIDFILE}` | |
rm ${PIDFILE};; | |
*) | |
echo "usage: $0 {start|stop}" ;; | |
esac | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment