diff options
author | Dirk Engling <erdgeist@erdgeist.org> | 2021-01-18 16:01:44 +0100 |
---|---|---|
committer | Dirk Engling <erdgeist@erdgeist.org> | 2021-01-18 16:01:44 +0100 |
commit | 930b8f18e604ab9b4b358c147676bfb3c8e7c503 (patch) | |
tree | b0d4936db37457a934249361695205e1d136994c | |
parent | 5a6f773a33af78b1b94ea7159cf3128914923b2b (diff) |
Add rc script for freebsd
-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 | |||