ports/news/nzbhydra2/files/nzbhydra2.in
Tobias C. Berner 8c06f3f158 [NEW PORT] news/nzbhydra2: Usenet meta search
NZBHydra 2 is a meta search for NZB indexers. It provides easy access to a
number of raw and newznab based indexers. You can search all your indexers
from one place and use it as an indexer source for tools like Sonarr,
Radarr or CouchPotato.

WWW: https://github.com/theotherp/nzbhydra2

PR:		234537
Submitted by:	Daniel Shafer <daniel shafer cc>
Differential_Revision:	https://reviews.freebsd.org/D18704
2019-01-29 20:14:34 +00:00

58 lines
1.6 KiB
Bash

#!/bin/sh
#
# $FreeBSD$
#
# PROVIDE: nzbhydra2
# REQUIRE: LOGIN
# KEYWORD: shutdown
#
# Add the following lines to /etc/rc.conf.local or /etc/rc.conf
# to enable this service:
#
# nzbhydra2_enable (bool): Set to NO by default.
# Set it to YES to enable it.
# nzbhydra2_user: The user account nzbhydra 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.
# nzbhydra2_group: The group account nzbhydra daemon runs as what
# you want it to be. It uses 'nzbhydra2' group by
# default. Do not sets it as empty or it will run
# as wheel.
# nzbhydra2_dir: Directory where nzbhydra lives.
# Default: %%PREFIX%%/share/nzbhydra2
# nzbhydra2_datafolder: Data directory for nzbhydra (DB, Logs, config)
# Default: %%PREFIX%%/nzbhydra2
. /etc/rc.subr
name="nzbhydra2"
rcvar=${name}_enable
load_rc_config ${name}
: ${nzbhydra2_enable:="NO"}
: ${nzbhydra2_user:="nzbhydra2"}
: ${nzbhydra2_group:="nzbhydra2"}
: ${nzbhydra2_dir:="%%PREFIX%%/share/nzbhydra2"}
: ${nzbhydra2_datafolder:="%%PREFIX%%/nzbhydra2"}
pidfile="/var/run/nzbhydra2/nzbhydra2.pid"
command="%%PYTHON_CMD%%"
command_args="${nzbhydra2_dir}/nzbhydra2wrapper.py --datafolder ${nzbhydra2_datafolder} --pidfile ${pidfile} --daemon --nobrowser --java %%JAVA%%"
start_precmd="prestart"
prestart() {
if [ -f ${pidfile} ]; then
rm -f ${pidfile}
echo "Removing stale pidfile."
elif [ ! -d ${pidfile%/*} ]; then
install -d -o ${nzbhydra2_user} -g ${nzbhydra2_group} ${pidfile%/*}
fi
if [ ! -d ${nzbhydra2_datadir} ]; then
install -d -o ${nzbhydra2_user} -g ${nzbhydra2_group} ${nzbhydra2_datadir}
fi
}
run_rc_command "$1"