blob: dda3506621545659a15abdb09f11d3deeb8fdd2c [file] [log] [blame]
ajs54b52522004-12-22 03:02:46 +00001#!/bin/bash
ajs54b52522004-12-22 03:02:46 +00002# chkconfig: 2345 17 83
David Warda41242b2012-04-29 16:47:07 -04003
4### BEGIN INIT INFO
5# Provides: watchquagga
6# Short-Description: Quagga watchdog
7# Description: Quagga watchdog for use with Zebra
8### END INIT INFO
ajs54b52522004-12-22 03:02:46 +00009
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
ajs54b52522004-12-22 03:02:46 +000019RETVAL=0
David Warda41242b2012-04-29 16:47:07 -040020PROG="watchquagga"
21cmd=watchquagga
22LOCK_FILE=/var/lock/subsys/watchquagga
ajs54b52522004-12-22 03:02:46 +000023
24case "$1" in
25 start)
David Warda41242b2012-04-29 16:47:07 -040026 # 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
ajs54b52522004-12-22 03:02:46 +000034 RETVAL=$?
David Warda41242b2012-04-29 16:47:07 -040035 [ $RETVAL -eq 0 ] && touch $LOCK_FILE
ajs54b52522004-12-22 03:02:46 +000036 echo
37 ;;
38 stop)
David Warda41242b2012-04-29 16:47:07 -040039 echo -n $"Shutting down $PROG: "
40 killproc $cmd
ajs54b52522004-12-22 03:02:46 +000041 RETVAL=$?
David Warda41242b2012-04-29 16:47:07 -040042 [ $RETVAL -eq 0 ] && rm -f $LOCK_FILE
ajs54b52522004-12-22 03:02:46 +000043 echo
44 ;;
David Warda41242b2012-04-29 16:47:07 -040045 restart|reload|force-reload)
46 $0 stop
47 $0 start
ajs54b52522004-12-22 03:02:46 +000048 RETVAL=$?
David Warda41242b2012-04-29 16:47:07 -040049 ;;
50 condrestart|try-restart)
51 if [ -f $LOCK_FILE ]; then
52 $0 stop
ajs54b52522004-12-22 03:02:46 +000053 $0 start
David Warda41242b2012-04-29 16:47:07 -040054 fi
ajs54b52522004-12-22 03:02:46 +000055 RETVAL=$?
David Warda41242b2012-04-29 16:47:07 -040056 ;;
ajs54b52522004-12-22 03:02:46 +000057 status)
David Warda41242b2012-04-29 16:47:07 -040058 status $cmd
ajs54b52522004-12-22 03:02:46 +000059 RETVAL=$?
David Warda41242b2012-04-29 16:47:07 -040060 ;;
ajs54b52522004-12-22 03:02:46 +000061 *)
David Warda41242b2012-04-29 16:47:07 -040062 echo $"Usage: $0 {start|stop|restart|reload|force-reload|condrestart|try-restart|status}"
63 exit 2
ajs54b52522004-12-22 03:02:46 +000064esac
65
66exit $RETVAL