blob: 9bf52da1d36bbc9bdd5197f7b04d762d0102361c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
|
#!/bin/sh
#
# /etc/rc.d/rc./arpwatch
#
# Start/stop/restart/status arpwatch.
ARPDIR="/var/lib/arpwatch"
IFACE="$2"
OPTIONS="-i $IFACE -f $ARPDIR/arp-$IFACE.dat -u root -e root -s root"
pid="$(ps ax | awk '{if (match($5, ".*/arpwatch$") || $5 == "arpwatch") print $1}')"
start() {
if [ "$IFACE" = "" ]; then
echo "Please specify interface name"
exit 1
else
if [ ! -f "$ARPDIR/arp-$IFACE.dat" ]; then
echo "Creating new database file..."
touch $ARPDIR/arp-$IFACE.dat
echo "Starting arpwatch on $IFACE..."
arpwatch $OPTIONS
else
echo "Starting arpwatch on $IFACE..."
arpwatch $OPTIONS
fi
fi
}
stop() {
echo "Stopping arpwatch..."
killall arpwatch
}
status() {
if [ "$pid" != "" ]; then
echo "arpwatch (pid "$pid") is running..."
else
echo "arpwatch is not running..."
fi
}
case "$1" in
'start')
start
;;
'stop')
stop
;;
'restart')
stop
start
;;
'status')
status
;;
*)
echo ""
echo "Usage: $0 {start [IFACE] | stop | restart [IFACE] | status}"
echo ""
exit 1
esac
|