aboutsummaryrefslogtreecommitdiff
path: root/network/quagga/rc.watchquagga
blob: 4901da99a88158658e2666b654192e65baab7713 (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
#!/bin/sh

start() {
	if [ -x /usr/sbin/watchquagga ]; then

	for i in zebra bgpd isisd ospfd ospf6d pimd ripd ripngd nhrpd; do
	if [ -e /var/run/quagga/$i.pid ] ; then
	    WATCHSERVICES="${WATCHSERVICES} ${i}"
	fi
	done

	echo -n "Starting watchquagga:  "
	/usr/sbin/watchquagga -dz -R '/etc/rc.d/rc.quagga restart' $WATCHSERVICES || exit 1
	echo "done"
	fi
}

stop() {
	echo -n "Stopping watchquagga: "
	    killall watchquagga 2>/dev/null && echo -n "done" || echo -n "not started"
	echo
}

restart() {
	stop && sleep 2s && start
}

case "$1" in
	'start')
		start
		;;
	'stop')
		stop
		;;
	'restart')
		restart
		;;
	*)
		echo "usage $0 start|stop|restart"
esac