]>
Commit | Line | Data |
---|---|---|
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. | |
6 | # processname: arpwatch | |
7 | ||
63276756 | 8 | |
9 | # Source function library | |
7b0d0d3a AF |
10 | . /etc/rc.d/init.d/functions |
11 | ||
63276756 | 12 | # Get network config |
7b0d0d3a AF |
13 | . /etc/sysconfig/network |
14 | ||
63276756 | 15 | # Get service config |
16 | [ -f /etc/sysconfig/arpwatch ] && . /etc/sysconfig/arpwatch | |
17 | ||
7b0d0d3a | 18 | # Check that networking is up. |
a454c97d | 19 | if [ "${NETWORKING}" = "no" ]; then |
86be8f28 | 20 | msg_Network_Down "arpwatch" |
a454c97d | 21 | exit 1 |
22 | fi | |
63276756 | 23 | |
7b0d0d3a AF |
24 | |
25 | # See how we were called. | |
26 | case "$1" in | |
27 | start) | |
63276756 | 28 | # Check if the service is already running? |
29 | if [ ! -f /var/lock/subsys/arpwatch ]; then | |
59e8e33f AF |
30 | if [ -z "$INTERFACES" ]; then |
31 | INTERFACES="`/sbin/ip link show \ | |
32 | | egrep '^[^ ].*' |egrep -v "NOARP|LOOPBACK" \ | |
33 | |sed 's/[0-9]*: \([a-zA-Z0-9]*\)[@:].*/\1/'|xargs`" | |
34 | fi | |
35 | for IFC in $INTERFACES; do | |
89306011 | 36 | msg_starting "arpwatch" |
12c0e377 JR |
37 | touch /var/lib/arpwatch/$IFC.dat |
38 | daemon arpwatch -i $IFC -f /var/lib/arpwatch/$IFC.dat | |
86be8f28 | 39 | RETVAL=$? |
40 | [ $RETVAL -eq 0 ] && touch /var/lock/subsys/arpwatch | |
59e8e33f | 41 | done |
63276756 | 42 | else |
86be8f28 | 43 | msg_Already_Running "arpwatch" |
63276756 | 44 | fi |
7b0d0d3a AF |
45 | ;; |
46 | stop) | |
86be8f28 | 47 | if [ -f /var/lock/subsys/arpwatch ]; then |
48 | msg_stopping "arpwatch" | |
49 | killproc arpwatch | |
50 | rm -f /var/lock/subsys/arpwatch >/dev/null 2>&1 | |
51 | else | |
52 | msg_Not_Running "arpwatch" | |
53 | exit 1 | |
54 | fi | |
7b0d0d3a AF |
55 | ;; |
56 | status) | |
57 | status arpwatch | |
58 | ;; | |
59 | restart|reload) | |
60 | $0 stop | |
61 | $0 start | |
62 | ;; | |
63 | *) | |
86be8f28 | 64 | msg_Usage "$0 {start|stop|status|restart|reload}" |
7b0d0d3a AF |
65 | exit 1 |
66 | esac | |
67 | ||
86be8f28 | 68 | exit $RETVAL |