Skip to content

Instantly share code, notes, and snippets.

@haukurk
Last active August 29, 2015 14:03
Show Gist options
  • Save haukurk/56e2f5d02bd4b50f69bf to your computer and use it in GitHub Desktop.
Save haukurk/56e2f5d02bd4b50f69bf to your computer and use it in GitHub Desktop.
Supervisor init file for Centos 6.X and default settings for supervisor installed from PyPi.
#!/bin/bash
#
# /etc/rc.d/init.d/supervisord
# supervisord This shell script takes care of starting and stopping
# supervisord.
# Tested with Centos 6.X and supervisord installed with pip.
#
# Author: Brian Bouterse [email protected]
# Author: Haukur Kristinsson [email protected] 2014
#
# chkconfig: 345 80 80
# description: supervisord is a client/server process control system. \
# processname: supervisord
# pidfile: /var/run/supervisord.pid
# Source function library.
. /etc/init.d/functions
DAEMON=/usr/bin/supervisord
PIDFILE=/var/run/supervisord.pid
CONFIG=/etc/supervisord.conf
# Exit if the package is not installed
[ -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 $DAEMON -c $CONFIG --pidfile=$PIDFILE
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && 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