From 930b8f18e604ab9b4b358c147676bfb3c8e7c503 Mon Sep 17 00:00:00 2001 From: Dirk Engling Date: Mon, 18 Jan 2021 16:01:44 +0100 Subject: Add rc script for freebsd --- udplogger.rc | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 udplogger.rc (limited to 'udplogger.rc') diff --git a/udplogger.rc b/udplogger.rc new file mode 100644 index 0000000..1b205a4 --- /dev/null +++ b/udplogger.rc @@ -0,0 +1,35 @@ +#!/bin/sh + +# PROVIDE: udplogger +# REQUIRE: FILESYSTEMS +# KEYWORD: shutdown + +. /etc/rc.subr + +name=udplogger +rcvar="${name}_enable" + +udplogger_daemon_user="nobody" +udplogger_command="/usr/local/bin/udplogger" +udplogger_command_flags="/var/log/udplogger" + +pidfile="/var/run/${name}.pid" + +command="/usr/sbin/daemon" +command_args="-r -o /var/log/udplogger.log -u ${udplogger_daemon_user} -P ${pidfile} ${udplogger_command} ${udplogger_command_flags}" + +stop_postcmd="udplogger_shutdown" + +udplogger_shutdown() +{ + if [ -e "${pidfile}" ]; then + echo "Stopping supervising daemon." + kill -s TERM `cat ${pidfile}` + fi +} + +load_rc_config $name +: ${udplogger_enable:=no} + +run_rc_command "$1" + -- cgit v1.2.3