]> git.pld-linux.org Git - packages/arpwatch.git/blame - arpwatch.init
- FHS 2.0 fixes (/var/db -> /var/state)
[packages/arpwatch.git] / arpwatch.init
CommitLineData
cd77786f 1#!/bin/sh
7b0d0d3a
AF
2#
3# chkconfig: - 55 45
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 19if [ "${NETWORKING}" = "no" ]; then
20 echo "WARNING: Networking is down. Arpwatch service can't be runed."
21 exit 1
22fi
63276756 23
7b0d0d3a
AF
24
25# See how we were called.
26case "$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
36 show "Starting arpwatch for $IFC"
37 touch /var/state/arpwatch/$IFC.dat
38 daemon arpwatch -i $IFC -f /var/state/arpwatch/$IFC.dat
39 done
63276756 40 else
41 echo "arpwatch already is running"
42 fi
7b0d0d3a
AF
43 touch /var/lock/subsys/arpwatch
44 ;;
45 stop)
59e8e33f 46 show "Stopping arpwatch"
7b0d0d3a
AF
47 killproc arpwatch
48 rm -f /var/lock/subsys/arpwatch
49 ;;
50 status)
51 status arpwatch
52 ;;
53 restart|reload)
54 $0 stop
55 $0 start
56 ;;
57 *)
cd77786f 58 echo "Usage: $0 {start|stop|status|restart|reload}"
7b0d0d3a
AF
59 exit 1
60esac
61
62exit 0
This page took 0.033674 seconds and 4 git commands to generate.