forked from CouchPotato/CouchPotatoServer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
freebsd
49 lines (41 loc) · 1.71 KB
/
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
#!/bin/sh
#
# PROVIDE: couchpotato
# REQUIRE: DAEMON
# KEYWORD: shutdown
# Add the following lines to /etc/rc.conf to enable couchpotato:
# couchpotato_enable: Set to NO by default. Set it to YES to enable it.
# couchpotato_user: The user account CouchPotato daemon runs as what
# you want it to be.
# couchpotato_dir: Directory where CouchPotato lives.
# Default: /usr/local/CouchPotatoServer
# couchpotato_datadir: Directory where CouchPotato user data lives.
# Default: $couchpotato_dir/data
# couchpotato_conf: Directory where CouchPotato user data lives.
# Default: $couchpotato_datadir/settings.conf
# couchpotato_pid: Full path to PID file.
# Default: $couchpotato_datadir/couchpotato.pid
# couchpotato_flags: Set additonal flags as needed.
. /etc/rc.subr
name="couchpotato"
rcvar=couchpotato_enable
load_rc_config ${name}
: ${couchpotato_enable:=NO}
: ${couchpotato_user:=} #default is root
: ${couchpotato_dir:=/usr/local/CouchPotatoServer}
: ${couchpotato_datadir:=${couchpotato_dir}/data}
: ${couchpotato_conf:=} #default is datadir/settings.conf
: ${couchpotato_pid:=} #default is datadir/couchpotato.pid
: ${couchpotato_flags:=}
command="${couchpotato_dir}/CouchPotato.py"
command_interpreter="/usr/local/bin/python"
command_args="--daemon --data_dir ${couchpotato_datadir}"
# append optional flags
if [ -n "${couchpotato_pid}" ]; then
pidfile=${couchpotato_pid}
couchpotato_flags="${couchpotato_flags} --pid_file ${couchpotato_pid}"
fi
if [ -n "${couchpotato_conf}" ]; then
couchpotato_flags="${couchpotato_flags} --config_file ${couchpotato_conf}"
fi
run_rc_command "$1"