SickGear/init-scripts/init.freebsd

44 lines
1.2 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: 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="${sickgear_dir}/sickgear.py"
command_interpreter="/usr/local/bin/python"
command_args="--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"