1
0
mirror of https://git.FreeBSD.org/ports.git synced 2025-01-02 06:03:50 +00:00
freebsd-ports/net-p2p/sonarr/files/sonarr.in
2021-04-06 16:31:13 +02:00

43 lines
923 B
Bash

#!/bin/sh
#
# Author: Mark Felder <feld@FreeBSD.org>
# PROVIDE: sonarr
# REQUIRE: LOGIN
# KEYWORD: shutdown
# Add the following lines to /etc/rc.conf to enable sonarr:
# sonarr_enable="YES"
. /etc/rc.subr
name="sonarr"
rcvar=sonarr_enable
load_rc_config $name
: ${sonarr_enable="NO"}
: ${sonarr_user:="sonarr"}
: ${sonarr_data_dir:="%%PREFIX%%/sonarr"}
pidfile="${sonarr_data_dir}/sonarr.pid"
procname="%%PREFIX%%/bin/mono"
command="/usr/sbin/daemon"
command_args="-f ${procname} %%DATADIR%%/Sonarr.exe --nobrowser --data=${sonarr_data_dir}"
start_precmd=sonarr_precmd
sonarr_precmd()
{
export XDG_CONFIG_HOME=${sonarr_data_dir}
if [ ! -d ${sonarr_data_dir} ]; then
install -d -o ${sonarr_user} ${sonarr_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"