Wed, 08 Feb 2012 20:07:00 +0200
Update version, adapt patch, correct PID writing, correct build on newer
FreeBSD releases, and most importantly introduce new patch to try to
avoid segfault caused by multiple network interfaces with the same (or
no) address. This is common when configuring bridges and tunnels.
michael@64 | 1 | #!@l_prefix@/bin/openpkg rc |
michael@64 | 2 | ## |
michael@64 | 3 | ## rc.arpwatch -- runcommands |
michael@64 | 4 | ## |
michael@64 | 5 | |
michael@64 | 6 | %config |
michael@64 | 7 | arpwatch_enable="$openpkg_rc_def" |
michael@64 | 8 | arpwatch_log_prolog="true" |
michael@64 | 9 | arpwatch_log_epilog="true" |
michael@64 | 10 | arpwatch_log_numfiles="10" |
michael@64 | 11 | arpwatch_log_minsize="1M" |
michael@64 | 12 | arpwatch_log_complevel="9" |
michael@571 | 13 | arpwatch_iface="lo0" |
michael@571 | 14 | arpwatch_ipnet="127.0.0.0/8" |
michael@64 | 15 | |
michael@64 | 16 | %common |
michael@64 | 17 | arpwatch_pidfile="@l_prefix@/var/arpwatch/run/arpwatch.pid" |
michael@64 | 18 | arpwatch_signal () { |
michael@64 | 19 | [ -f $arpwatch_pidfile ] && kill -$1 `cat $arpwatch_pidfile` |
michael@64 | 20 | } |
michael@64 | 21 | |
michael@64 | 22 | %status -u @l_susr@ -o |
michael@64 | 23 | arpwatch_usable="no" |
michael@64 | 24 | arpwatch_active="no" |
michael@64 | 25 | rcService arpwatch enable yes && \ |
michael@64 | 26 | arpwatch_usable="yes" |
michael@64 | 27 | rcService arpwatch enable yes && \ |
michael@64 | 28 | arpwatch_signal 0 && arpwatch_active="yes" |
michael@64 | 29 | echo "arpwatch_enable=\"$arpwatch_enable\"" |
michael@64 | 30 | echo "arpwatch_usable=\"$arpwatch_usable\"" |
michael@64 | 31 | echo "arpwatch_active=\"$arpwatch_active\"" |
michael@64 | 32 | |
michael@64 | 33 | %start -u @l_susr@ |
michael@64 | 34 | rcService arpwatch enable yes || exit 0 |
michael@64 | 35 | rcService arpwatch active yes && exit 0 |
michael@64 | 36 | @l_prefix@/sbin/arpwatch \ |
michael@571 | 37 | -i $arpwatch_iface \ |
michael@571 | 38 | -n $arpwatch_ipnet \ |
michael@64 | 39 | >$arpwatch_pidfile 2>&1 |
michael@64 | 40 | |
michael@64 | 41 | %stop -u @l_susr@ |
michael@64 | 42 | rcService arpwatch enable yes || exit 0 |
michael@64 | 43 | rcService arpwatch active no && exit 0 |
michael@64 | 44 | arpwatch_signal TERM |
michael@64 | 45 | |
michael@64 | 46 | %restart -u @l_susr@ |
michael@64 | 47 | rcService arpwatch enable yes || exit 0 |
michael@64 | 48 | rcService arpwatch active no && exit 0 |
michael@64 | 49 | rc arpwatch stop |
michael@64 | 50 | sleep 2 |
michael@64 | 51 | rc arpwatch start |
michael@64 | 52 | |
michael@64 | 53 | %reload -u @l_susr@ |
michael@64 | 54 | rcService arpwatch enable yes || exit 0 |
michael@64 | 55 | rcService arpwatch active no && exit 0 |
michael@64 | 56 | arpwatch_signal HUP |
michael@64 | 57 | |
michael@64 | 58 | %daily -u @l_susr@ |
michael@64 | 59 | rcService arpwatch enable yes || exit 0 |
michael@64 | 60 | shtool rotate -f \ |
michael@64 | 61 | -n ${arpwatch_log_numfiles} -s ${arpwatch_log_minsize} -d \ |
michael@64 | 62 | -z ${arpwatch_log_complevel} -o @l_susr@ -g @l_mgrp@ -m 644 \ |
michael@64 | 63 | -P "${arpwatch_log_prolog}" \ |
michael@64 | 64 | -E "${arpwatch_log_epilog}; rc arpwatch restart" \ |
michael@64 | 65 | @l_prefix@/var/arpwatch/log/arpwatch.log \ |
michael@64 | 66 | @l_prefix@/var/arpwatch/log/arpsnmp.log |