Last active
May 28, 2018 13:18
-
-
Save macta/0f30e73a6f5670f301795eacd25f6f0e to your computer and use it in GitHub Desktop.
init script for supervisord that works on Ubuntu 16. You need to copy this into /etc/init.d. (See comment for more instructions)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/bash -e | |
### BEGIN INIT INFO | |
# Provides: supervisor | |
# Required-Start: $remote_fs $network $named | |
# Required-Stop: $remote_fs $network $named | |
# Default-Start: 2 3 4 5 | |
# Default-Stop: 0 1 6 | |
# Short-Description: Start/stop supervisor | |
# Description: Start/stop supervisor daemon and its configured | |
# subprocesses. | |
### END INIT INFO | |
SUPERVISORD=/usr/local/bin/supervisord | |
PIDFILE=/tmp/supervisord.pid | |
OPTS="-c /etc/supervisord.conf" | |
test -x $SUPERVISORD || exit 0 | |
. /lib/lsb/init-functions | |
export PATH="${PATH:+$PATH:}/usr/local/bin:/usr/sbin:/sbin" | |
case "$1" in | |
start) | |
log_begin_msg "Starting Supervisor daemon manager..." | |
start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $SUPERVISORD -- $OPTS || log_end_msg 1 | |
log_end_msg 0 | |
;; | |
stop) | |
log_begin_msg "Stopping Supervisor daemon manager..." | |
start-stop-daemon --stop --quiet --oknodo --pidfile $PIDFILE || log_end_msg 1 | |
log_end_msg 0 | |
;; | |
restart|reload|force-reload) | |
log_begin_msg "Restarting Supervisor daemon manager..." | |
start-stop-daemon --stop --quiet --oknodo --retry 30 --pidfile $PIDFILE | |
start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $SUPERVISORD -- $OPTS || log_end_msg 1 | |
log_end_msg 0 | |
;; | |
*) | |
log_success_msg "Usage: /etc/init.d/supervisor | |
{start|stop|reload|force-reload|restart}" | |
exit 1 | |
esac | |
exit 0 |
In preference use systemd to this approach (see alternate gists)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Copy the file into init.d then run: