Skip to content

Instantly share code, notes, and snippets.

@ihor
Last active January 19, 2018 11:54

Revisions

  1. ihor renamed this gist Jan 19, 2018. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  2. ihor created this gist Oct 3, 2012.
    56 changes: 56 additions & 0 deletions supervisor
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,56 @@
    #!/bin/bash

    DAEMON=/usr/local/bin/supervisord
    OPTS='-c /usr/local/etc/supervisor/supervisord.conf'
    NAME=supervisor
    DESC=supervisor

    test -x $DAEMON || exit 0
    set -e

    start()
    {
    $DAEMON $OPTS > /dev/null 2>&1 &
    return
    }

    stop()
    {
    kill -SIGQUIT `cat /usr/local/var/run/supervisord.pid`
    return
    }

    case "$1" in
    start)
    echo -n "Starting $DESC: "
    start
    echo "started."
    ;;

    stop)
    echo -n "Stopping $DESC: "
    stop
    echo "stopped."
    ;;

    restart|force-reload)
    echo -n "Restarting $DESC: "
    stop
    sleep 1
    start
    echo "restarted."
    ;;

    reload)
    echo -n "Reloading $DESC: "
    kill -SIGHUP `cat /usr/local/var/run/supervisord.pid`
    echo "reloaded."
    ;;

    *)
    echo "Usage: $0 {start|stop|restart|force-reload|reload}" >&2
    exit 1
    ;;
    esac

    exit 0