diff options
Diffstat (limited to 'archivers/unpackerr/files/unpackerr.in')
-rw-r--r-- | archivers/unpackerr/files/unpackerr.in | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/archivers/unpackerr/files/unpackerr.in b/archivers/unpackerr/files/unpackerr.in new file mode 100644 index 000000000000..af63a6d0cf09 --- /dev/null +++ b/archivers/unpackerr/files/unpackerr.in @@ -0,0 +1,49 @@ +#!/bin/sh + +# PROVIDE: unpackerr +# REQUIRE: LOGIN NETWORKING +# KEYWORD: shutdown + +# Add the following lines to /etc/rc.conf to enable unpackerr: +# unpackerr_enable (bool): Set to "NO" by default. +# Set it to "YES" to enable unpackerr +# unpackerr_configfile (str): Set to "%%PREFIX%%/etc/unpackerr.conf" by default. +# Configuration file for unpackerr +# unpackerr_user (str): Set to "unpackerr" by default. +# User to run unpackerr + +. /etc/rc.subr + +name=unpackerr +rcvar=unpackerr_enable + +start_precmd="${name}_precmd" +stop_postcmd="${name}_postcmd" +configtest_cmd="${name}_configtest" + +load_rc_config ${name} + +: ${unpackerr_enable:="no"} +: ${unpackerr_configfile:="%%PREFIX%%/etc/unpackerr/unpackerr.conf"} +: ${unpackerr_user:="unpackerr"} + +procname="%%PREFIX%%/bin/unpackerr" +pidfile="/var/run/${name}.pid" +daemonpidfile="/var/run/daemon_${name}.pid" +required_files="${unpackerr_configfile}" +command="/usr/sbin/daemon" + +unpackerr_precmd() +{ + rc_flags="-p ${pidfile} -P ${daemonpidfile} -f ${procname} -c ${unpackerr_configfile} ${rc_flags}" + + /usr/bin/install -m 600 -o ${unpackerr_user} /dev/null $pidfile + /usr/bin/install -m 600 -o ${unpackerr_user} /dev/null $daemonpidfile +} + +unpackerr_postcmd() +{ + rm -f $pidfile $daemonpidfile +} + +run_rc_command "$1" |