aboutsummaryrefslogtreecommitdiff
path: root/net-p2p/radarr/files/radarr.in
blob: afc4f037df70bf1b0401002dff05207c6b65f3ac (plain) (blame)
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
#!/bin/sh
#
# Author: Mark Felder <feld@FreeBSD.org>
#
# $FreeBSD$
#

# PROVIDE: radarr
# REQUIRE: LOGIN
# KEYWORD: shutdown

# Add the following lines to /etc/rc.conf to enable radarr:
# radarr_enable="YES"

. /etc/rc.subr

name="radarr"
rcvar=radarr_enable

load_rc_config $name

: ${radarr_enable="NO"}
: ${radarr_user:="radarr"}
: ${radarr_data_dir:="%%PREFIX%%/radarr"}

pidfile="${radarr_data_dir}/radarr.pid"
procname="%%PREFIX%%/bin/mono"
command="/usr/sbin/daemon"
command_args="-f ${procname} %%DATADIR%%/Radarr.exe --nobrowser --data=${radarr_data_dir}"
start_precmd=radarr_precmd

radarr_precmd()
{
	export XDG_CONFIG_HOME=${radarr_data_dir}

	if [ ! -d ${radarr_data_dir} ]; then
		install -d -o ${radarr_user} ${radarr_data_dir}
	fi

	# Unwritable pids allow the service to start, but fails to work
	# Rare, but if you are debugging as root and accidentally start the service...
	/bin/rm -f ${pidfile}
}

run_rc_command "$1"