paul | 788cdc6 | 2003-01-18 00:22:08 +0000 | [diff] [blame] | 1 | #!/bin/bash |
David Ward | a41242b | 2012-04-29 16:47:07 -0400 | [diff] [blame] | 2 | # chkconfig: - 15 85 |
paul | e835d10 | 2003-08-14 05:24:30 +0000 | [diff] [blame] | 3 | # config: /etc/quagga/zebra.conf |
paul | 788cdc6 | 2003-01-18 00:22:08 +0000 | [diff] [blame] | 4 | |
David Ward | a41242b | 2012-04-29 16:47:07 -0400 | [diff] [blame] | 5 | ### BEGIN INIT INFO |
6 | # Provides: zebra | ||||
7 | # Short-Description: GNU Zebra routing manager | ||||
8 | # Description: GNU Zebra routing manager | ||||
9 | ### END INIT INFO | ||||
10 | |||||
paul | 788cdc6 | 2003-01-18 00:22:08 +0000 | [diff] [blame] | 11 | # source function library |
12 | . /etc/rc.d/init.d/functions | ||||
13 | |||||
David Ward | a41242b | 2012-04-29 16:47:07 -0400 | [diff] [blame] | 14 | # Get network config |
15 | . /etc/sysconfig/network | ||||
16 | |||||
paul | 15d74e9 | 2003-12-30 11:16:21 +0000 | [diff] [blame] | 17 | # quagga command line options |
18 | . /etc/sysconfig/quagga | ||||
19 | |||||
paul | 788cdc6 | 2003-01-18 00:22:08 +0000 | [diff] [blame] | 20 | RETVAL=0 |
David Ward | a41242b | 2012-04-29 16:47:07 -0400 | [diff] [blame] | 21 | PROG="zebra" |
22 | cmd=zebra | ||||
23 | LOCK_FILE=/var/lock/subsys/zebra | ||||
24 | CONF_FILE=/etc/quagga/zebra.conf | ||||
paul | 788cdc6 | 2003-01-18 00:22:08 +0000 | [diff] [blame] | 25 | |
26 | case "$1" in | ||||
27 | start) | ||||
David Ward | a41242b | 2012-04-29 16:47:07 -0400 | [diff] [blame] | 28 | # Check that networking is up. |
29 | [ "${NETWORKING}" = "no" ] && exit 1 | ||||
paul | 788cdc6 | 2003-01-18 00:22:08 +0000 | [diff] [blame] | 30 | |
David Ward | a41242b | 2012-04-29 16:47:07 -0400 | [diff] [blame] | 31 | # The process must be configured first. |
32 | [ -f $CONF_FILE ] || exit 6 | ||||
33 | if [ `id -u` -ne 0 ]; then | ||||
34 | echo $"Insufficient privilege" 1>&2 | ||||
35 | exit 4 | ||||
36 | fi | ||||
37 | |||||
38 | echo -n $"Starting $PROG: " | ||||
paul | 788cdc6 | 2003-01-18 00:22:08 +0000 | [diff] [blame] | 39 | /sbin/ip route flush proto zebra |
David Ward | a41242b | 2012-04-29 16:47:07 -0400 | [diff] [blame] | 40 | daemon $cmd -d $ZEBRA_OPTS -f $CONF_FILE |
paul | 788cdc6 | 2003-01-18 00:22:08 +0000 | [diff] [blame] | 41 | RETVAL=$? |
David Ward | a41242b | 2012-04-29 16:47:07 -0400 | [diff] [blame] | 42 | [ $RETVAL -eq 0 ] && touch $LOCK_FILE |
paul | 788cdc6 | 2003-01-18 00:22:08 +0000 | [diff] [blame] | 43 | echo |
44 | ;; | ||||
45 | stop) | ||||
David Ward | a41242b | 2012-04-29 16:47:07 -0400 | [diff] [blame] | 46 | echo -n $"Shutting down $PROG: " |
47 | killproc $cmd | ||||
paul | 788cdc6 | 2003-01-18 00:22:08 +0000 | [diff] [blame] | 48 | RETVAL=$? |
David Ward | a41242b | 2012-04-29 16:47:07 -0400 | [diff] [blame] | 49 | [ $RETVAL -eq 0 ] && rm -f $LOCK_FILE |
paul | 788cdc6 | 2003-01-18 00:22:08 +0000 | [diff] [blame] | 50 | echo |
51 | ;; | ||||
David Ward | a41242b | 2012-04-29 16:47:07 -0400 | [diff] [blame] | 52 | restart|reload|force-reload) |
53 | $0 stop | ||||
54 | $0 start | ||||
paul | 788cdc6 | 2003-01-18 00:22:08 +0000 | [diff] [blame] | 55 | RETVAL=$? |
David Ward | a41242b | 2012-04-29 16:47:07 -0400 | [diff] [blame] | 56 | ;; |
57 | condrestart|try-restart) | ||||
58 | if [ -f $LOCK_FILE ]; then | ||||
59 | $0 stop | ||||
paul | 788cdc6 | 2003-01-18 00:22:08 +0000 | [diff] [blame] | 60 | $0 start |
David Ward | a41242b | 2012-04-29 16:47:07 -0400 | [diff] [blame] | 61 | fi |
paul | 788cdc6 | 2003-01-18 00:22:08 +0000 | [diff] [blame] | 62 | RETVAL=$? |
David Ward | a41242b | 2012-04-29 16:47:07 -0400 | [diff] [blame] | 63 | ;; |
paul | 788cdc6 | 2003-01-18 00:22:08 +0000 | [diff] [blame] | 64 | status) |
David Ward | a41242b | 2012-04-29 16:47:07 -0400 | [diff] [blame] | 65 | status $cmd |
paul | 788cdc6 | 2003-01-18 00:22:08 +0000 | [diff] [blame] | 66 | RETVAL=$? |
David Ward | a41242b | 2012-04-29 16:47:07 -0400 | [diff] [blame] | 67 | ;; |
paul | 788cdc6 | 2003-01-18 00:22:08 +0000 | [diff] [blame] | 68 | *) |
David Ward | a41242b | 2012-04-29 16:47:07 -0400 | [diff] [blame] | 69 | echo $"Usage: $0 {start|stop|restart|reload|force-reload|condrestart|try-restart|status}" |
70 | exit 2 | ||||
paul | 788cdc6 | 2003-01-18 00:22:08 +0000 | [diff] [blame] | 71 | esac |
72 | |||||
73 | exit $RETVAL |