]> git.pld-linux.org Git - packages/arpwatch.git/blame - arpwatch.init
- fix: use $IFC instead $INTERFACES on each loop iteration.
[packages/arpwatch.git] / arpwatch.init
CommitLineData
cd77786f 1#!/bin/sh
7b0d0d3a 2#
5417bfc6 3# chkconfig: 345 55 45
7b0d0d3a
AF
4# description: The arpwatch daemon attempts to keep track of ethernet/ip \
5# address pairings.
a1de136a 6# processname: arpwatch
63276756 7
8# Source function library
7b0d0d3a
AF
9. /etc/rc.d/init.d/functions
10
63276756 11# Get network config
7b0d0d3a
AF
12. /etc/sysconfig/network
13
63276756 14# Get service config
15[ -f /etc/sysconfig/arpwatch ] && . /etc/sysconfig/arpwatch
16
7b0d0d3a 17# Check that networking is up.
a454c97d 18if [ "${NETWORKING}" = "no" ]; then
86be8f28 19 msg_Network_Down "arpwatch"
a454c97d 20 exit 1
21fi
63276756 22
7b0d0d3a
AF
23
24# See how we were called.
25case "$1" in
26 start)
63276756 27 # Check if the service is already running?
28 if [ ! -f /var/lock/subsys/arpwatch ]; then
59e8e33f
AF
29 if [ -z "$INTERFACES" ]; then
30 INTERFACES="`/sbin/ip link show \
31 | egrep '^[^ ].*' |egrep -v "NOARP|LOOPBACK" \
32 |sed 's/[0-9]*: \([a-zA-Z0-9]*\)[@:].*/\1/'|xargs`"
33 fi
34 for IFC in $INTERFACES; do
0276d822 35 msg_starting "arpwatch ($IFC)"
12c0e377
JR
36 touch /var/lib/arpwatch/$IFC.dat
37 daemon arpwatch -i $IFC -f /var/lib/arpwatch/$IFC.dat
86be8f28 38 RETVAL=$?
39 [ $RETVAL -eq 0 ] && touch /var/lock/subsys/arpwatch
59e8e33f 40 done
63276756 41 else
86be8f28 42 msg_Already_Running "arpwatch"
63276756 43 fi
7b0d0d3a
AF
44 ;;
45 stop)
86be8f28 46 if [ -f /var/lock/subsys/arpwatch ]; then
47 msg_stopping "arpwatch"
48 killproc arpwatch
49 rm -f /var/lock/subsys/arpwatch >/dev/null 2>&1
50 else
51 msg_Not_Running "arpwatch"
52 exit 1
53 fi
7b0d0d3a
AF
54 ;;
55 status)
56 status arpwatch
57 ;;
58 restart|reload)
59 $0 stop
60 $0 start
61 ;;
62 *)
86be8f28 63 msg_Usage "$0 {start|stop|status|restart|reload}"
7b0d0d3a
AF
64 exit 1
65esac
66
86be8f28 67exit $RETVAL
This page took 0.558461 seconds and 4 git commands to generate.