1#!/bin/bash
2# chkconfig: 2345 17 83
3
4### BEGIN INIT INFO
5# Provides: watchquagga
6# Short-Description: Quagga watchdog
7# Description: Quagga watchdog for use with Zebra
8### END INIT INFO
9
10# source function library
11. /etc/rc.d/init.d/functions
12
13# Get network config
14. /etc/sysconfig/network
15
16# quagga command line options
17. /etc/sysconfig/quagga
18
19RETVAL=0
20PROG="watchquagga"
21cmd=watchquagga
22LOCK_FILE=/var/lock/subsys/watchquagga
23
24case "$1" in
25  start)
26	# Check that networking is up.
27	[ "${NETWORKING}" = "no" ] && exit 1
28
29	# Check that there are daemons to be monitored.
30	[ -z "$WATCH_DAEMONS" ] && exit 1
31
32	echo -n $"Starting $PROG: "
33	daemon $cmd -d $WATCH_OPTS $WATCH_DAEMONS
34	RETVAL=$?
35	[ $RETVAL -eq 0 ] && touch $LOCK_FILE
36	echo
37	;;
38  stop)
39	echo -n $"Shutting down $PROG: "
40	killproc $cmd
41	RETVAL=$?
42	[ $RETVAL -eq 0 ] && rm -f $LOCK_FILE
43	echo
44	;;
45  restart|reload|force-reload)
46	$0 stop
47	$0 start
48	RETVAL=$?
49	;;
50  condrestart|try-restart)
51	if [ -f $LOCK_FILE ]; then
52		$0 stop
53		$0 start
54	fi
55	RETVAL=$?
56	;;
57  status)
58	status $cmd
59	RETVAL=$?
60	;;
61  *)
62	echo $"Usage: $0 {start|stop|restart|reload|force-reload|condrestart|try-restart|status}"
63	exit 2
64esac
65
66exit $RETVAL
67