Created
July 7, 2016 22:16
-
-
Save Gabriellpweb/4b1faf05484cdb6558e93d0f57220231 to your computer and use it in GitHub Desktop.
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/sh | |
SUPERVISOR_INITD="/etc/init.d/supervisord" | |
SUPERVISOR_LOGDIR="/var/log/supervisord" | |
echo "Running install..." | |
easy_install supervisor; | |
mkdir -p /etc/supervisor/conf.d; | |
touch /etc/supervisor/supervisord.conf; | |
echo "Configuring ${SUPERVISOR_INITD} ..." | |
cat <<'EOF' > ${SUPERVISOR_INITD} | |
#!/bin/sh | |
# | |
# /etc/init.d/supervisord | |
. /etc/init.d/functions | |
RETVAL=0 | |
prog="supervisord" | |
pidfile="/tmp/supervisord.pid" | |
lockfile="/var/lock/subsys/supervisord" | |
SUPERVISOR_PATH="/usr/local/bin/supervisord" | |
CONFIG_PATH="/etc/supervisor/supervisord.conf" | |
FLAGS="-c ${CONFIG_PATH}" | |
start() | |
{ | |
echo -n $"Starting $prog: " | |
daemon --pidfile $pidfile ${SUPERVISOR_PATH} ${FLAGS} | |
RETVAL=$? | |
echo | |
[ $RETVAL -eq 0 ] && touch ${lockfile} | |
} | |
stop() | |
{ | |
echo -n $"Shutting down $prog: " | |
killproc -p ${pidfile} ${SUPERVISOR_PATH} | |
RETVAL=$? | |
echo | |
if [ $RETVAL -eq 0 ] ; then | |
rm -f ${lockfile} ${pidfile} | |
fi | |
} | |
case "$1" in | |
start) | |
start | |
;; | |
stop) | |
stop | |
;; | |
status) | |
status $prog | |
;; | |
restart) | |
stop | |
start | |
;; | |
*) | |
echo "Usage: $0 {start|stop|restart|status}" | |
;; | |
esac | |
EOF | |
echo "Configuring permissions..." | |
chmod a+x $SUPERVISOR_INITD | |
mkdir -p /var/log/supervisord | |
echo "Configuring /etc/supervisor/supervisord.conf ..." | |
cat <<'EOF' > /etc/supervisor/supervisord.conf | |
[unix_http_server] | |
file=/tmp/supervisor.sock | |
[include] | |
files = /etc/supervisor/conf.d/*.conf | |
[supervisord] | |
logfile=/var/log/supervisord/supervisord.log | |
logfile_maxbytes=50MB | |
logfile_backups=6 | |
loglevel=error | |
pidfile=/tmp/supervisord.pid | |
nodaemon=false | |
minfds=1024 | |
minprocs=200 | |
user=root | |
childlogdir=/var/log/supervisord/ | |
[supervisorctl] | |
serverurl=unix:///tmp/supervisor.sock | |
[rpcinterface:supervisor] | |
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface | |
EOF | |
echo "Completed!" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment