-
-
Save johananl/5af21019116b65e8b587 to your computer and use it in GitHub Desktop.
init.d for supervisord for Amazon Linux AMI
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 | |
# Amazon Linux AMI startup script for a supervisor instance | |
# | |
# chkconfig: 2345 80 20 | |
# description: Autostarts supervisord. | |
# Source function library. | |
. /etc/rc.d/init.d/functions | |
supervisorctl="/usr/local/bin/supervisorctl" | |
supervisord="/usr/local/bin/supervisord" | |
configfile="/etc/supervisord.conf" | |
name="supervisor-python" | |
[ -f $supervisord ] || exit 1 | |
[ -f $supervisorctl ] || exit 1 | |
RETVAL=0 | |
start() { | |
echo -n "Starting $name: " | |
$supervisord -c $configfile | |
RETVAL=$? | |
echo | |
return $RETVAL | |
} | |
stop() { | |
echo -n "Stopping $name: " | |
$supervisorctl shutdown | |
RETVAL=$? | |
echo | |
return $RETVAL | |
} | |
case "$1" in | |
start) | |
start | |
;; | |
stop) | |
stop | |
;; | |
restart) | |
stop | |
start | |
;; | |
esac | |
exit $REVAL |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment