$ sudo mv supervisor /etc/init.d
$ sudo chkconfig --add supervisor
$ sudo chkconfig supervisor on
-
-
Save juanmanavarro/2aa59d74f2d2eeb5e03c1e4977ee77c0 to your computer and use it in GitHub Desktop.
init.d for supervisord for Amazon Linux AMI
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/bash | |
# | |
# supervisor Start/Stop the supervisor daemon. | |
# | |
# chkconfig: 345 90 10 | |
# description: Supervisor is a client/server system that allows its users to | |
# monitor and control a number of processes on UNIX-like operating | |
# systems. | |
. /etc/init.d/functions | |
DAEMON=/usr/bin/supervisord | |
PIDFILE=/var/run/supervisord.pid | |
[ -x "$DAEMON" ] || exit 0 | |
start() { | |
echo -n "Starting supervisord: " | |
if [ -f $PIDFILE ]; then | |
PID=`cat $PIDFILE` | |
echo supervisord already running: $PID | |
exit 2; | |
else | |
daemon sudo $DAEMON --pidfile=$PIDFILE -c /etc/supervisord.d/supervisord.conf -u root | |
RETVAL=$? | |
echo | |
[ $RETVAL -eq 0 ] && sudo touch /var/lock/subsys/supervisord | |
return $RETVAL | |
fi | |
} | |
stop() { | |
echo -n "Shutting down supervisord: " | |
echo | |
killproc -p $PIDFILE supervisord | |
echo | |
rm -f /var/lock/subsys/supervisord | |
return 0 | |
} | |
case "$1" in | |
start) | |
start | |
;; | |
stop) | |
stop | |
;; | |
status) | |
status supervisord | |
;; | |
restart) | |
stop | |
start | |
;; | |
*) | |
echo "Usage: {start|stop|status|restart}" | |
exit 1 | |
;; | |
esac | |
exit $? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment