summaryrefslogtreecommitdiffstats
path: root/main/arpwatch/arpwatch.initd
blob: 069d9b93f70e5620212808bd1a57f109c86ebfee (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
#!/sbin/runscript
# Copyright 1999-2006 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/www/viewcvs.gentoo.org/raw_cvs/gentoo-x86/net-analyzer/arpwatch/files/arpwatch.initd,v 1.1 2007/06/02 22:37:16 jokey Exp $

depend() {
	need net
	after firewall
}

start() {
	checkpath -d -o ${ARPUSER}\
		-m 0755 /var/run/arpwatch
				 
	for IFACE in ${IFACES}
	do
		ebegin "Starting arpwatch on ${IFACE}"
		DATAFILE=/var/lib/arpwatch/${IFACE}.dat
		[ ! -f ${DATAFILE} ] && touch ${DATAFILE}

		if [ -z ${ARPUSER} ]; then
			start-stop-daemon --start --quiet --pidfile=/var/run/arpwatch/arpwatch.${IFACE}.pid --exec \
			/usr/sbin/arpwatch -- -i ${IFACE} -f ${DATAFILE} -P /var/run/arpwatch/arpwatch.${IFACE}.pid ${OPTIONS}
		else
			chown ${ARPUSER} ${DATAFILE}
			start-stop-daemon --start --quiet --pidfile=/var/run/arpwatch/arpwatch.${IFACE}.pid --exec \
			/usr/sbin/arpwatch -- -i $IFACE -u ${ARPUSER} -f ${DATAFILE} -P /var/run/arpwatch/arpwatch.${IFACE}.pid ${OPTIONS}
		fi
		eend $?
	done
}

stop() {
	for IFACE in ${IFACES}
	do
		ebegin "Stopping arpwatch on ${IFACE}"
		start-stop-daemon --stop --quiet --pidfile=/var/run/arpwatch/arpwatch.${IFACE}.pid --exec \
		/usr/sbin/arpwatch
		eend $?
	done
}