summaryrefslogtreecommitdiff
path: root/udplogger.rc
blob: 1b205a455aec75d146564e75b8f448047bd228ee (plain)
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
#!/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"