Skip to content

Instantly share code, notes, and snippets.

@IPrism
Forked from cwsaylor/gist:17522
Created July 7, 2011 13:34
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 IPrism/1069516 to your computer and use it in GitHub Desktop.
Save IPrism/1069516 to your computer and use it in GitHub Desktop.
God init script
#!/bin/bash
### BEGIN INIT INFO
# Provides: god
# Required-Start: $all
# Required-Stop: $network $local_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start the god monitoring processes
# Description: Enable god at boot time.
### END INIT INFO
CONF_DIR=/etc/god/*
PID=/var/run/god.pid
LOG=/var/log/god.log
RETVAL=0
case "$1" in
start)
god -P $PID --no-syslog -l $LOG --log-level warn
god load $CONF_DIR
RETVAL=$?
;;
stop)
kill `cat $PID`
RETVAL=$?
;;
restart)
kill `cat $PID`
god -P $PID --no-syslog -l $LOG --log-level warn
god load $CONF_DIR
RETVAL=$?
;;
status)
RETVAL=$?
;;
*)
echo "Usage: god {start|stop|restart|status}"
exit 1
;;
esac
exit $RETVAL
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment