blob: 260396a571f91ac8ad14fe91a9deeeff0bb84753 (
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
|
#!/bin/sh
#
# $FreeBSD$
#
# PROVIDE: arpwatch
# REQUIRE: NETWORKING
# KEYWORD: FreeBSD
# Add the following lines to /etc/rc.conf to enable arpwatch:
#
#arpwatch_enable="YES"
#
arpwatch_enable=${arpwatch_enable:-"NO"}
arpwatch_dir="%%PREFIX%%/arpwatch/"
arpwatch_interfaces=
. %%RC_SUBR%%
name=arpwatch
rcvar=`set_rcvar`
required_dirs=${arpwatch_dir}
load_rc_config ${name}
command="%%PREFIX%%/sbin/${name}"
start_precmd=${name}_precmd
arpwatch_precmd() {
case ${arpwatch_interfaces} in
'')
echo prcmd
if [ ! -e "${arpwatch_dir}/arp.dat" ]; then
if [ -e "${arpwatch_dir}/arp.dat-" ]; then
cp "${arpwatch_dir}/arp.dat-" "${arpwatch_dir}/arp.dat"
else
touch "${arpwatch_dir}/arp.dat"
fi
fi
;;
*)
for interface in ${arpwatch_interfaces}; do
if [ ! -e "${arpwatch_dir}/arp.${interface}.dat" ]; then
if [ -e "${arpwatch_dir}/arp.${interface}.dat-" ]; then
cp "${arpwatch_dir}/arp.${interface}.dat-" "${arpwatch_dir}/arp.${interface}.dat"
else
touch "${arpwatch_dir}/arp.${interface}.dat"
fi
fi
done
;;
esac
}
arpwatch_stop() {
killall arpwatch
}
case ${arpwatch_interfaces} in
'')
echo 'meuh'
run_rc_command "$1"
;;
*)
if [ "$1" = "start" ]; then
for interface in ${arpwatch_interfaces}; do
eval options=\$arpwatch_${interface}_options
command_args="-i ${interface} ${options} -f arp.${interface}.dat"
pidfile="/var/run/arpwatch-${interface}.pid"
run_rc_command "$1"
done
else
run_rc_command "$1"
fi
;;
esac
|