Create a gist now

Instantly share code, notes, and snippets.

#!/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