]> git.pld-linux.org Git - packages/arpwatch.git/blame - arpwatch.init
- removed TODO - done
[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
bade4eed 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
82ef92d3 34 [ ! -z "$NETWORKS" ] && NETWORKS="-n $NETWORKS"
59e8e33f 35 for IFC in $INTERFACES; do
0276d822 36 msg_starting "arpwatch ($IFC)"
12c0e377 37 touch /var/lib/arpwatch/$IFC.dat
82ef92d3 38 daemon arpwatch $NETWORKS -i $IFC -f /var/lib/arpwatch/$IFC.dat -u daemon
86be8f28 39 RETVAL=$?
40 [ $RETVAL -eq 0 ] && touch /var/lock/subsys/arpwatch
59e8e33f 41 done
63276756 42 else
bade4eed 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
bade4eed 52 msg_not_running "arpwatch"
86be8f28 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 *)
bade4eed 64 msg_usage "$0 {start|stop|status|restart|reload}"
7b0d0d3a
AF
65 exit 1
66esac
67
86be8f28 68exit $RETVAL
This page took 0.096419 seconds and 4 git commands to generate.