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