Skip to content

Instantly share code, notes, and snippets.

@saily
Created November 24, 2014 09:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save saily/9371581d0b9e16b90f2c to your computer and use it in GitHub Desktop.
Save saily/9371581d0b9e16b90f2c to your computer and use it in GitHub Desktop.
#!/bin/bash
#
# supervisord This scripts turns supervisord on
#
# Author: Mike McGrath <mmcgrath@redhat.com> (based off yumupdatesd)
# Jason Koppe <jkoppe@indeed.com> adjusted to read sysconfig,
# use supervisord tools to start/stop, conditionally wait
# for child processes to shutdown, and startup later
#
# chkconfig: 345 83 04
#
# description: supervisor is a process control utility. It has a web based
# xmlrpc interface as well as a few other nifty features.
# processname: supervisord
# config: ${buildout:parts-directory}/${:_buildout_section_name_}/supervisord.conf
# pidfile: ${buildout:directory}/var/supervisord.pid
#
# Modified to be used as `collective.recipe.template` source by
# Daniel Widerin <daniel.widerin@zumtobelgroup.com>, 2014-11-24
#
# source function library
. /etc/rc.d/init.d/functions
BUILDOUT_HOME="${buildout:directory}"
SUPERVISORD="$BUILDOUT_HOME/bin/supervisord"
SUPERVISORCTL="$BUILDOUT_HOME/bin/supervisorctl"
RETVAL=0
start() {
$SUPERVISORD
}
stop() {
$SUPERVISORCTL shutdown
}
restart() {
$SUPERVISORCTL restart all
}
status() {
$SUPERVISORCTL status
}
case "$1" in
start)
start
;;
stop)
stop
;;
status)
status
;;
restart)
restart
;;
*)
echo $"Usage: $0 {start|stop|status|restart}"
RETVAL=2
esac
exit $RETVAL
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment