Created
December 3, 2008 18:51
-
-
Save jonathannelson/31641 to your computer and use it in GitHub Desktop.
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
#!/bin/sh | |
### BEGIN INIT INFO | |
# Provides: god | |
# Required-Start: $all | |
# Required-Stop: $all | |
# Default-Start: 2 3 4 5 | |
# Default-Stop: 0 1 6 | |
# Short-Description: God | |
### END INIT INFO | |
NAME=god | |
DESC=god | |
set -e | |
# Make sure the binary and the config file are present before proceeding | |
test -x /usr/bin/god || exit 0 | |
# Create this file and put in a variable called GOD_CONFIG, pointing to | |
# our God configuration file | |
test -f /var/www/apps/foo/current && . /var/www/apps/foo/current | |
[ $GOD_CONFIG ] || exit 0 | |
. /etc/init.d/functions | |
RETVAL=0 | |
case "$1" in | |
start) | |
echo -n "Starting $DESC: " | |
/usr/bin/god -c $GOD_CONFIG -P /var/run/god.pid -l /var/log/god.log | |
RETVAL=$? | |
echo "$NAME." | |
;; | |
stop) | |
echo -n "Stopping $DESC: " | |
kill `cat /var/run/god.pid` | |
RETVAL=$? | |
echo "$NAME." | |
;; | |
restart) | |
echo -n "Restarting $DESC: " | |
kill `cat /var/run/god.pid` | |
/usr/bin/god -c $GOD_CONFIG -P /var/run/god.pid -l /var/log/god.log | |
RETVAL=$? | |
echo "$NAME." | |
;; | |
status) | |
/usr/bin/god 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