Skip to content

Instantly share code, notes, and snippets.

@Trexology
Last active July 18, 2016 13:51
Show Gist options
  • Save Trexology/6bd490d69f8f5682e12470c83dbb140f to your computer and use it in GitHub Desktop.
Save Trexology/6bd490d69f8f5682e12470c83dbb140f to your computer and use it in GitHub Desktop.
Supervisord init.d script for EC2 linux easy_install - http://tech.akat.info/?p=1931
#!/bin/sh
#
# /etc/rc.d/init.d/supervisord
#
# Supervisor is a client/server system that
# allows its users to monitor and control a
# number of processes on UNIX-like operating
# systems.
#
# chkconfig: - 64 36
# description: Supervisor Server
# processname: supervisord
# Source init functions
. /etc/init.d/functions
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
RETVAL=0
prog="supervisord"
pidfile="/tmp/supervisord.pid"
lockfile="/var/lock/subsys/supervisord"
configfile="/etc/supervisor/supervisord.conf"
start()
{
echo -n $"Starting $prog: "
daemon --pidfile $pidfile supervisord -c $configfile
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && touch ${lockfile}
}
stop()
{
echo -n $"Shutting down $prog: "
killproc -p ${pidfile} /usr/bin/supervisord
RETVAL=$?
echo
if [ $RETVAL -eq 0 ] ; then
rm -f ${lockfile} ${pidfile}
fi
}
case "$1" in
start)
start
;;
stop)
stop
;;
status)
status $prog
;;
restart)
stop
start
;;
*)
echo "Usage: $0 {start|stop|restart|status}"
;;
esac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment