blob: 4242b16c43a98f1ba295d97e0e8974775e957dbd [file] [log] [blame]
paul788cdc62003-01-18 00:22:08 +00001#!/bin/bash
David Warda41242b2012-04-29 16:47:07 -04002# chkconfig: - 15 85
paule835d102003-08-14 05:24:30 +00003# config: /etc/quagga/zebra.conf
paul788cdc62003-01-18 00:22:08 +00004
David Warda41242b2012-04-29 16:47:07 -04005### BEGIN INIT INFO
6# Provides: zebra
7# Short-Description: GNU Zebra routing manager
8# Description: GNU Zebra routing manager
9### END INIT INFO
10
paul788cdc62003-01-18 00:22:08 +000011# source function library
12. /etc/rc.d/init.d/functions
13
David Warda41242b2012-04-29 16:47:07 -040014# Get network config
15. /etc/sysconfig/network
16
paul15d74e92003-12-30 11:16:21 +000017# quagga command line options
18. /etc/sysconfig/quagga
19
paul788cdc62003-01-18 00:22:08 +000020RETVAL=0
David Warda41242b2012-04-29 16:47:07 -040021PROG="zebra"
22cmd=zebra
23LOCK_FILE=/var/lock/subsys/zebra
24CONF_FILE=/etc/quagga/zebra.conf
paul788cdc62003-01-18 00:22:08 +000025
26case "$1" in
27 start)
David Warda41242b2012-04-29 16:47:07 -040028 # Check that networking is up.
29 [ "${NETWORKING}" = "no" ] && exit 1
paul788cdc62003-01-18 00:22:08 +000030
David Warda41242b2012-04-29 16:47:07 -040031 # 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: "
paul788cdc62003-01-18 00:22:08 +000039 /sbin/ip route flush proto zebra
David Warda41242b2012-04-29 16:47:07 -040040 daemon $cmd -d $ZEBRA_OPTS -f $CONF_FILE
paul788cdc62003-01-18 00:22:08 +000041 RETVAL=$?
David Warda41242b2012-04-29 16:47:07 -040042 [ $RETVAL -eq 0 ] && touch $LOCK_FILE
paul788cdc62003-01-18 00:22:08 +000043 echo
44 ;;
45 stop)
David Warda41242b2012-04-29 16:47:07 -040046 echo -n $"Shutting down $PROG: "
47 killproc $cmd
paul788cdc62003-01-18 00:22:08 +000048 RETVAL=$?
David Warda41242b2012-04-29 16:47:07 -040049 [ $RETVAL -eq 0 ] && rm -f $LOCK_FILE
paul788cdc62003-01-18 00:22:08 +000050 echo
51 ;;
David Warda41242b2012-04-29 16:47:07 -040052 restart|reload|force-reload)
53 $0 stop
54 $0 start
paul788cdc62003-01-18 00:22:08 +000055 RETVAL=$?
David Warda41242b2012-04-29 16:47:07 -040056 ;;
57 condrestart|try-restart)
58 if [ -f $LOCK_FILE ]; then
59 $0 stop
paul788cdc62003-01-18 00:22:08 +000060 $0 start
David Warda41242b2012-04-29 16:47:07 -040061 fi
paul788cdc62003-01-18 00:22:08 +000062 RETVAL=$?
David Warda41242b2012-04-29 16:47:07 -040063 ;;
paul788cdc62003-01-18 00:22:08 +000064 status)
David Warda41242b2012-04-29 16:47:07 -040065 status $cmd
paul788cdc62003-01-18 00:22:08 +000066 RETVAL=$?
David Warda41242b2012-04-29 16:47:07 -040067 ;;
paul788cdc62003-01-18 00:22:08 +000068 *)
David Warda41242b2012-04-29 16:47:07 -040069 echo $"Usage: $0 {start|stop|restart|reload|force-reload|condrestart|try-restart|status}"
70 exit 2
paul788cdc62003-01-18 00:22:08 +000071esac
72
73exit $RETVAL