Skip to content

Instantly share code, notes, and snippets.

@fossilet
Last active December 16, 2016 03:19
Show Gist options
  • Save fossilet/a729e9cf781f209f7cd024998d025b52 to your computer and use it in GitHub Desktop.
Save fossilet/a729e9cf781f209f7cd024998d025b52 to your computer and use it in GitHub Desktop.

Revisions

  1. fossilet revised this gist Dec 16, 2016. 1 changed file with 6 additions and 0 deletions.
    6 changes: 6 additions & 0 deletions supervisord
    Original file line number Diff line number Diff line change
    @@ -2,6 +2,12 @@
    #
    # From: http://serverfault.com/a/259230/53861
    #
    # INSTALL:
    # sudo cp supervisord /etc/init.d
    # sudo chkconfig --add supervisord
    # sudo chkconfig supervisord on
    # service supervisord start
    #
    # /etc/rc.d/init.d/supervisord
    #
    # Supervisor is a client/server system that
  2. fossilet revised this gist Dec 16, 2016. No changes.
  3. fossilet created this gist Dec 5, 2016.
    64 changes: 64 additions & 0 deletions supervisord
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,64 @@
    #!/bin/sh
    #
    # From: http://serverfault.com/a/259230/53861
    #
    # /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/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