]> git.pld-linux.org Git - packages/arpwatch.git/blob - arpwatch.init
- don't mess with CFLAGS
[packages/arpwatch.git] / arpwatch.init
1 #!/bin/sh
2 #
3 # chkconfig: 345 55 45
4 # description:  The arpwatch daemon attempts to keep track of ethernet/ip \
5 #               address pairings.
6 # processname: arpwatch
7
8
9 # Source function library
10 . /etc/rc.d/init.d/functions
11
12 # Get network config
13 . /etc/sysconfig/network
14
15 # Get service config
16 [ -f /etc/sysconfig/arpwatch ] && . /etc/sysconfig/arpwatch
17
18 # Check that networking is up.
19 if [ "${NETWORKING}" = "no" ]; then
20         msg_Network_Down "arpwatch"
21         exit 1
22 fi
23
24
25 # See how we were called.
26 case "$1" in
27   start)
28         # Check if the service is already running?
29         if [ ! -f /var/lock/subsys/arpwatch ]; then
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
36                         msg_starting "arpwatch"
37                         touch /var/lib/arpwatch/$IFC.dat
38                         daemon arpwatch -i $IFC -f /var/lib/arpwatch/$IFC.dat
39                         RETVAL=$?
40                         [ $RETVAL -eq 0 ] && touch /var/lock/subsys/arpwatch
41                 done
42         else
43                 msg_Already_Running "arpwatch"
44         fi
45         ;;
46   stop)
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      
55         ;;
56   status)
57         status arpwatch
58         ;;
59   restart|reload)
60         $0 stop
61         $0 start
62         ;;
63   *)
64         msg_Usage "$0 {start|stop|status|restart|reload}"
65         exit 1
66 esac
67
68 exit $RETVAL
This page took 0.063238 seconds and 3 git commands to generate.