Skip to content

Instantly share code, notes, and snippets.

@adw0rd adw0rd/supervisord
Created Oct 1, 2012

Embed
What would you like to do?
supervisord init-script
#!/bin/sh
# PROVIDE: supervisord
# REQUIRE: DAEMON
# KEYWORD: shutdown
#
# Add the following line to /etc/rc.conf.local or /etc/rc.conf
# to enable supervisord:
#
# supervisord_enable="YES"
#
# supervisord_conffile="/usr/local/etc/supervisord.conf"
# -- path to config file
# supervisord_pidfile="/var/run/supervisor/supervisord.pid"
# -- location of pidfile: must match setting in ${supervisord_conffile}
# supervisord_user="supervisor"
# -- user to run supervisord
# supervisord_group="supervisor"
# -- group to run supervisord
# supervisord_logdir="/var/log/supervisord"
# -- directory supervisord writes logs
#
#
. /etc/rc.subr
name=supervisord
rcvar=supervisord_enable
load_rc_config $name
: ${supervisord_enable="NO"}
: ${supervisord_conffile="/usr/local/etc/supervisord.conf"}
: ${supervisord_pidfile="/var/run/supervisor/supervisord.pid"}
: ${supervisord_user="supervisor"}
: ${supervisord_group="supervisor"}
: ${supervisord_logdir="/var/log/supervisord"}
command="/usr/local/bin/${name}"
command_args="\
--configuration ${supervisord_conffile} \
--user ${supervisord_user} \
--logfile ${supervisord_logdir}/out.log \
--pidfile ${supervisord_pidfile}"
pidfile=${supervisord_pidfile}
required_files=${supervisord_conffile}
command_interpreter="/usr/local/bin/python2.7"
start_precmd="${name}_prestart"
supervisord_prestart ()
{
piddir=$(dirname ${supervisord_pidfile})
if [ ! -d ${piddir} ]; then
mkdir -m 755 -p ${piddir}
chown -R ${supervisord_user}:${supervisord_group} ${piddir}
fi
if [ ! -d ${supervisord_logdir} ]; then
mkdir -m 755 -p ${supervisord_logdir}
chown -R ${supervisord_user}:${supervisord_group} ${supervisord_logdir}
fi
}
run_rc_command "$1"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.