2014-03-10 01:18:05 -04:00
|
|
|
#!/bin/sh
|
|
|
|
#
|
|
|
|
# PROVIDE: sickbeard
|
|
|
|
# REQUIRE: LOGIN
|
|
|
|
# KEYWORD: shutdown
|
|
|
|
#
|
|
|
|
# Add the following lines to /etc/rc.conf.local or /etc/rc.conf
|
|
|
|
# to enable this service:
|
|
|
|
#
|
|
|
|
# sickbeard_enable (bool): Set to NO by default.
|
|
|
|
# Set it to YES to enable it.
|
2014-11-22 13:59:32 -05:00
|
|
|
# sickbeard_user: The user account SickRage daemon runs as what
|
2014-03-10 01:18:05 -04:00
|
|
|
# you want it to be. It uses '_sabnzbd' user by
|
|
|
|
# default. Do not sets it as empty or it will run
|
|
|
|
# as root.
|
2014-11-22 13:59:32 -05:00
|
|
|
# sickbeard_group: The group account SickRage daemon runs as what
|
|
|
|
# you want it to be. It uses '_sabnzbd' group by
|
|
|
|
# default. Do not sets it as empty or it will run
|
|
|
|
# as wheel.
|
2014-05-23 08:37:22 -04:00
|
|
|
# sickbeard_dir: Directory where SickRage lives.
|
2014-03-10 01:18:05 -04:00
|
|
|
# Default: /usr/local/sickbeard
|
2014-11-22 13:59:32 -05:00
|
|
|
# sickbeard_datadir: Data directory for Sick Beard (DB, Logs, config)
|
|
|
|
# Default is same as sickbeard_dir
|
2014-03-10 01:18:05 -04:00
|
|
|
|
|
|
|
. /etc/rc.subr
|
|
|
|
|
|
|
|
name="sickbeard"
|
|
|
|
rcvar=${name}_enable
|
|
|
|
|
|
|
|
load_rc_config ${name}
|
|
|
|
|
|
|
|
: ${sickbeard_enable:="NO"}
|
|
|
|
: ${sickbeard_user:="_sabnzbd"}
|
2014-11-22 13:59:32 -05:00
|
|
|
: ${sickbeard_group:="_sabnzbd"}
|
2014-03-10 01:18:05 -04:00
|
|
|
: ${sickbeard_dir:="/usr/local/sickbeard"}
|
2014-11-22 13:59:32 -05:00
|
|
|
: ${sickbeard_datadir:="${sickbeard_dir}"}
|
|
|
|
|
|
|
|
pidfile="/var/run/sickbeard/sickbeard.pid"
|
|
|
|
command="/usr/local/bin/python2.7"
|
|
|
|
command_args="${sickbeard_dir}/SickBeard.py --datadir ${sickbeard_datadir} -d --pidfile ${pidfile} --quiet --nolaunch"
|
|
|
|
|
|
|
|
start_precmd="sickbeard_prestart"
|
|
|
|
sickbeard_prestart() {
|
|
|
|
if [ -f ${pidfile} ]; then
|
|
|
|
rm -f ${pidfile}
|
|
|
|
echo "Removing stale pidfile."
|
|
|
|
elif [ ! -d ${pidfile%/*} ]; then
|
|
|
|
install -d -o ${sickbeard_user} -g ${sickbeard_group} ${pidfile%/*}
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ ! -d ${sickbeard_datadir} ]; then
|
|
|
|
install -d -o ${sickbeard_user} -g ${sickbeard_group} ${sickbeard_datadir}
|
|
|
|
fi
|
2014-03-10 01:18:05 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
run_rc_command "$1"
|