Created
April 23, 2010 17:19
-
-
Save griggheo/376831 to your computer and use it in GitHub Desktop.
This file contains 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 | |
# Startup script for a supervisor instance | |
# | |
# chkconfig: 2345 80 20 | |
# description: supervisord | |
supervisorctl="/usr/local/bin/supervisorctl" | |
supervisord="/usr/local/bin/supervisord" | |
pid="/var/run/supervisord.pid" | |
name="supervisord" | |
[ -f $supervisord ] || exit 1 | |
[ -f $supervisorctl ] || exit 1 | |
RETVAL=0 | |
start() { | |
echo -n "Starting $name: " | |
$supervisord | |
RETVAL=$? | |
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/$name | |
echo | |
return $RETVAL | |
} | |
stop() { | |
echo -n "Stopping $name: " | |
$supervisorctl shutdown | |
RETVAL=$? | |
[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/$name | |
echo | |
return $RETVAL | |
} | |
reload() { | |
kill -HUP `cat $pid` | |
RETVAL=$? | |
return $RETVAL | |
} | |
case "$1" in | |
start) | |
start | |
;; | |
stop) | |
stop | |
;; | |
restart) | |
stop | |
start | |
;; | |
reload) | |
reload | |
;; | |
*) | |
echo "Usage: $0 start|stop|restart|reload" | |
exit 1 | |
;; | |
esac | |
exit $RETVAL |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment