SickGear/init-scripts/init.freebsd

52 lines
1.6 KiB
Text
Raw Normal View History

#!/bin/sh
#
# PROVIDE: sickgear
# REQUIRE: LOGIN
# KEYWORD: shutdown
#
# Add the following lines to /etc/rc.conf.local or /etc/rc.conf
# to enable this service:
#
# sickgear_enable (bool): Set to NO by default.
# Set it to YES to enable it.
# sickgear_user: The user account SickGear daemon runs as what
# you want it to be. It uses '_sabnzbd' user by
# default. Do not sets it as empty or it will run
# as root.
# sickgear_dir: Directory where SickGear lives.
# Default: /usr/local/sickgear
# sickgear_chdir: Change to this directory before running SickGear.
# Default is same as sickgear_dir.
# sickgear_datadir: Data directory for Sick Beard (DB, Logs, config)
# Default is same as sickgear_chdir
# sickgear_pidfile: The name of the pidfile to create.
# Default is sickgear.pid in sickgear_dir.
# sickgear_port: The port SickGear is listening on
# Default is 8081
PATH="/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin"
. /etc/rc.subr
name="sickgear"
rcvar=${name}_enable
load_rc_config ${name}
: ${sickgear_enable:="NO"}
: ${sickgear_user:="_sabnzbd"}
: ${sickgear_dir:="/usr/local/sickgear"}
: ${sickgear_chdir:="${sickgear_dir}"}
: ${sickgear_datadir:="${sickgear_chdir}"}
: ${sickgear_pidfile:="${sickgear_dir}/sickgear.pid"}
: ${sickgear_host:="127.0.0.1"}
: ${sickgear_port:="8081"}
command="/usr/local/bin/python"
command_args="${sickgear_dir}/SickBeard.py --daemon --pidfile ${sickgear_pidfile}"
# Add datadir to the command if set
[ ! -z "${sickgear_datadir}" ] && \
command_args="${command_args} --datadir ${sickgear_datadir}"
run_rc_command "$1"