summaryrefslogtreecommitdiff
blob: dc1fda286a3dbe86b30cb1f10d4714721d5954d6 (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
#!/sbin/runscript
# Copyright 1999-2006 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/net-misc/ip-sentinel/files/ip-sentinel.init,v 1.3 2006/07/11 17:41:19 pva Exp $

CFG_FILE="/etc/ip-sentinel.cfg"

depend() {
        need net
}

checkconfig() {
	if [ ! -f "${CFG_FILE}" ] ; then
		eerror "File ${CFG_FILE} does not exists!"
		return 1
	fi

	if [ -n "${CHROOT}" ] ; then
		local_opts="--user ipsentinel --group ipsentinel -r ${CHROOT}"
	else
		local_opts="--user ipsentinel --group ipsentinel -r /"
	fi
}

start() {
	checkconfig || return 1

	ebegin "Starting ip-sentinel..."
	start-stop-daemon --start --quiet --exec /usr/sbin/ip-sentinel -- --ipfile ${CFG_FILE} ${local_opts} $OPTS $IFACE &
	eend $? "Failed to start ip-sentinel"
}

stop() {
	ebegin "Stoping ip-sentinel..."
	start-stop-daemon --stop --quiet --pidfile /var/run/ip-sentinel.run
	eend $? "Failed to stop ip-sentinel"
}

restart () {
	svc_stop
	echo "Please, wait while child process quit..."
	while `ps aux | grep -v 'init.d' | grep [i]p-sentinel >/dev/null`
	do
		echo -n ". "
		sleep 1
	done
	echo "[Done]"
	svc_start
}