forked from SiCKRAGE/SiCKRAGE
-
Notifications
You must be signed in to change notification settings - Fork 0
/
init.freebsd
executable file
·56 lines (48 loc) · 1.61 KB
/
init.freebsd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#!/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.
# sickbeard_user: The user account SickRage 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.
# 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.
# sickbeard_dir: Directory where SickRage lives.
# Default: /usr/local/sickbeard
# sickbeard_datadir: Data directory for Sick Beard (DB, Logs, config)
# Default is same as sickbeard_dir
. /etc/rc.subr
name="sickbeard"
rcvar=${name}_enable
load_rc_config ${name}
: ${sickbeard_enable:="NO"}
: ${sickbeard_user:="_sabnzbd"}
: ${sickbeard_group:="_sabnzbd"}
: ${sickbeard_dir:="/usr/local/sickbeard"}
: ${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
}
run_rc_command "$1"