diff options
-rw-r--r-- | udplogger.rc | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/udplogger.rc b/udplogger.rc new file mode 100644 index 0000000..1b205a4 --- /dev/null +++ b/udplogger.rc | |||
@@ -0,0 +1,35 @@ | |||
1 | #!/bin/sh | ||
2 | |||
3 | # PROVIDE: udplogger | ||
4 | # REQUIRE: FILESYSTEMS | ||
5 | # KEYWORD: shutdown | ||
6 | |||
7 | . /etc/rc.subr | ||
8 | |||
9 | name=udplogger | ||
10 | rcvar="${name}_enable" | ||
11 | |||
12 | udplogger_daemon_user="nobody" | ||
13 | udplogger_command="/usr/local/bin/udplogger" | ||
14 | udplogger_command_flags="/var/log/udplogger" | ||
15 | |||
16 | pidfile="/var/run/${name}.pid" | ||
17 | |||
18 | command="/usr/sbin/daemon" | ||
19 | command_args="-r -o /var/log/udplogger.log -u ${udplogger_daemon_user} -P ${pidfile} ${udplogger_command} ${udplogger_command_flags}" | ||
20 | |||
21 | stop_postcmd="udplogger_shutdown" | ||
22 | |||
23 | udplogger_shutdown() | ||
24 | { | ||
25 | if [ -e "${pidfile}" ]; then | ||
26 | echo "Stopping supervising daemon." | ||
27 | kill -s TERM `cat ${pidfile}` | ||
28 | fi | ||
29 | } | ||
30 | |||
31 | load_rc_config $name | ||
32 | : ${udplogger_enable:=no} | ||
33 | |||
34 | run_rc_command "$1" | ||
35 | |||