Supervisord

From Alessandro's Wiki
Jump to navigation Jump to search

Supervisord is a tiny tool that gives huge benefits. It controls the startup and stop of defained programs/services. It works both from command line and from a web GUI

* http://supervisord.org/configuration.html

install

apt-get install python-setuptools
easy_install supervisor 

add a plone instance

start at boot

sudo curl http://gist.github.com/raw/176149/88d0d68c4af22a7474ad1d011659ea2d27e35b8d/supervisord.sh > /etc/init.d/supervisord
sudo chmod +x /etc/init.d/supervisord
sudo chmod +x /etc/init.d/supervisord
  • in debian based:
sudo update-rc.d supervisord defaults
  • in redhat
chkconfig --add supervisord

<syntaxhighlight lang=bash>

  1. !/bin/sh
  2. /etc/rc.d/init.d/supervisord
  3. Supervisor is a client/server system that
  4. allows its users to monitor and control a
  5. number of processes on UNIX-like operating
  6. systems.
  7. chkconfig: - 64 36
  8. description: Supervisor Server
  9. processname: supervisord
  1. Source init functions

. /etc/rc.d/init.d/functions

prog="supervisord"

prefix="/usr/" exec_prefix="${prefix}" prog_bin="${exec_prefix}/bin/supervisord" PIDFILE="/var/run/$prog.pid"

start() {

       echo -n $"Starting $prog: "
       daemon $prog_bin --pidfile $PIDFILE
       [ -f $PIDFILE ] && success $"$prog startup" || failure $"$prog startup"
       echo

}

stop() {

       echo -n $"Shutting down $prog: "
       [ -f $PIDFILE ] && killproc $prog || success $"$prog shutdown"
       echo

}

case "$1" in

 start)
   start
 ;;
 stop)
   stop
 ;;
 status)
       status $prog
 ;;
 restart)
   stop
   start
 ;;
 *)
   echo "Usage: $0 {start|stop|restart|status}"
 ;;

esac <syntaxhighlight>