SickGear/init-scripts/init.freebsd

42 lines
1.2 KiB
Bash
Executable file

#!/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: Set YES to enable.
# Default: NO
# sickgear_user: The user account SickGear daemon runs as.
# Default: '_sickgear' -- do not set empty or SG will run as root.
# sickgear_dir: Directory where SickGear lives.
# Default: /usr/local/sickgear
# sickgear_datadir: Data directory for SickGear (DB, Logs, config)
# Default: same as sickgear_dir
# sickgear_pidfile: The name of the pidfile to create.
# Default: sickgear.pid in sickgear_dir.
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:="_sickgear"}
: ${sickgear_dir:="/usr/local/sickgear"}
: ${sickgear_datadir:="${sickgear_dir}"}
: ${sickgear_pidfile:="${sickgear_dir}/sickgear.pid"}
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"