ajs | 54b5252 | 2004-12-22 03:02:46 +0000 | [diff] [blame] | 1 | #!/bin/bash |
ajs | 54b5252 | 2004-12-22 03:02:46 +0000 | [diff] [blame] | 2 | # chkconfig: 2345 17 83 |
David Ward | a41242b | 2012-04-29 16:47:07 -0400 | [diff] [blame] | 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 | ||||
ajs | 54b5252 | 2004-12-22 03:02:46 +0000 | [diff] [blame] | 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 | |||||
ajs | 54b5252 | 2004-12-22 03:02:46 +0000 | [diff] [blame] | 19 | RETVAL=0 |
David Ward | a41242b | 2012-04-29 16:47:07 -0400 | [diff] [blame] | 20 | PROG="watchquagga" |
21 | cmd=watchquagga | ||||
22 | LOCK_FILE=/var/lock/subsys/watchquagga | ||||
ajs | 54b5252 | 2004-12-22 03:02:46 +0000 | [diff] [blame] | 23 | |
24 | case "$1" in | ||||
25 | start) | ||||
David Ward | a41242b | 2012-04-29 16:47:07 -0400 | [diff] [blame] | 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 | ||||
ajs | 54b5252 | 2004-12-22 03:02:46 +0000 | [diff] [blame] | 34 | RETVAL=$? |
David Ward | a41242b | 2012-04-29 16:47:07 -0400 | [diff] [blame] | 35 | [ $RETVAL -eq 0 ] && touch $LOCK_FILE |
ajs | 54b5252 | 2004-12-22 03:02:46 +0000 | [diff] [blame] | 36 | echo |
37 | ;; | ||||
38 | stop) | ||||
David Ward | a41242b | 2012-04-29 16:47:07 -0400 | [diff] [blame] | 39 | echo -n $"Shutting down $PROG: " |
40 | killproc $cmd | ||||
ajs | 54b5252 | 2004-12-22 03:02:46 +0000 | [diff] [blame] | 41 | RETVAL=$? |
David Ward | a41242b | 2012-04-29 16:47:07 -0400 | [diff] [blame] | 42 | [ $RETVAL -eq 0 ] && rm -f $LOCK_FILE |
ajs | 54b5252 | 2004-12-22 03:02:46 +0000 | [diff] [blame] | 43 | echo |
44 | ;; | ||||
David Ward | a41242b | 2012-04-29 16:47:07 -0400 | [diff] [blame] | 45 | restart|reload|force-reload) |
46 | $0 stop | ||||
47 | $0 start | ||||
ajs | 54b5252 | 2004-12-22 03:02:46 +0000 | [diff] [blame] | 48 | RETVAL=$? |
David Ward | a41242b | 2012-04-29 16:47:07 -0400 | [diff] [blame] | 49 | ;; |
50 | condrestart|try-restart) | ||||
51 | if [ -f $LOCK_FILE ]; then | ||||
52 | $0 stop | ||||
ajs | 54b5252 | 2004-12-22 03:02:46 +0000 | [diff] [blame] | 53 | $0 start |
David Ward | a41242b | 2012-04-29 16:47:07 -0400 | [diff] [blame] | 54 | fi |
ajs | 54b5252 | 2004-12-22 03:02:46 +0000 | [diff] [blame] | 55 | RETVAL=$? |
David Ward | a41242b | 2012-04-29 16:47:07 -0400 | [diff] [blame] | 56 | ;; |
ajs | 54b5252 | 2004-12-22 03:02:46 +0000 | [diff] [blame] | 57 | status) |
David Ward | a41242b | 2012-04-29 16:47:07 -0400 | [diff] [blame] | 58 | status $cmd |
ajs | 54b5252 | 2004-12-22 03:02:46 +0000 | [diff] [blame] | 59 | RETVAL=$? |
David Ward | a41242b | 2012-04-29 16:47:07 -0400 | [diff] [blame] | 60 | ;; |
ajs | 54b5252 | 2004-12-22 03:02:46 +0000 | [diff] [blame] | 61 | *) |
David Ward | a41242b | 2012-04-29 16:47:07 -0400 | [diff] [blame] | 62 | echo $"Usage: $0 {start|stop|restart|reload|force-reload|condrestart|try-restart|status}" |
63 | exit 2 | ||||
ajs | 54b5252 | 2004-12-22 03:02:46 +0000 | [diff] [blame] | 64 | esac |
65 | |||||
66 | exit $RETVAL |