]> git.puffer.fish Git - mirror/frr.git/commitdiff
redhat: update initscripts
authorDavid Ward <david.ward@ll.mit.edu>
Sun, 29 Apr 2012 20:47:07 +0000 (16:47 -0400)
committerDavid Lamparter <equinox@diac24.net>
Tue, 1 May 2012 15:51:26 +0000 (17:51 +0200)
Taken from Fedora packaging with additional fixes.

 * redhat/*.init: make all initscripts LSB-compliant;
     store the daemon configuration file location in $CONF_FILE,
     and perform existence testing before starting the daemon
 * redhat/babeld.init: add initscript for Babel routing engine
 * redhat/quagga.sysconfig: add command-line options for babeld;
     remove the daemon configuration file locations from $*_OPTS;
     clarify directions for configuring watchquagga
 * redhat/Makefile.am: add babeld.init to distribution

Signed-off-by: David Ward <david.ward@ll.mit.edu>
Signed-off-by: David Lamparter <equinox@diac24.net>
redhat/Makefile.am
redhat/babeld.init [new file with mode: 0644]
redhat/bgpd.init
redhat/isisd.init
redhat/ospf6d.init
redhat/ospfd.init
redhat/quagga.sysconfig
redhat/ripd.init
redhat/ripngd.init
redhat/watchquagga.init
redhat/zebra.init

index 6a3d38f706295188f95e9a8c5664d7398c352545..e037ec5771a02b674cfa9f1cd0d229c9cb73342d 100644 (file)
@@ -1,4 +1,4 @@
 
 EXTRA_DIST = quagga.pam quagga.sysconfig quagga.spec quagga.logrotate \
        zebra.init ripd.init ospfd.init ripngd.init ospf6d.init bgpd.init \
-       isisd.init watchquagga.init quagga.pam.stack
+       isisd.init babeld.init watchquagga.init quagga.pam.stack
diff --git a/redhat/babeld.init b/redhat/babeld.init
new file mode 100644 (file)
index 0000000..76e8e5e
--- /dev/null
@@ -0,0 +1,72 @@
+#!/bin/bash
+# chkconfig: - 16 84
+# config: /etc/quagga/babeld.conf
+
+### BEGIN INIT INFO
+# Provides: babeld
+# Short-Description: Babel routing engine
+# Description: Babel routing engine for use with Zebra
+### END INIT INFO
+
+# source function library
+. /etc/rc.d/init.d/functions
+
+# Get network config
+. /etc/sysconfig/network
+
+# quagga command line options
+. /etc/sysconfig/quagga
+
+RETVAL=0
+PROG="babeld"
+cmd=babeld
+LOCK_FILE=/var/lock/subsys/babeld
+CONF_FILE=/etc/quagga/babeld.conf
+
+case "$1" in
+  start)
+       # Check that networking is up.
+       [ "${NETWORKING}" = "no" ] && exit 1
+
+       # The process must be configured first.
+       [ -f $CONF_FILE ] || exit 6
+       if [ `id -u` -ne 0 ]; then
+               echo $"Insufficient privilege" 1>&2
+               exit 4
+       fi
+
+       echo -n $"Starting $PROG: "
+       daemon $cmd -d $BABELD_OPTS -f $CONF_FILE
+       RETVAL=$?
+       [ $RETVAL -eq 0 ] && touch $LOCK_FILE
+       echo
+       ;;
+  stop)
+       echo -n $"Shutting down $PROG: "
+       killproc $cmd
+       RETVAL=$?
+       [ $RETVAL -eq 0 ] && rm -f $LOCK_FILE
+       echo
+       ;;
+  restart|reload|force-reload)
+       $0 stop
+       $0 start
+       RETVAL=$?
+       ;;
+  condrestart|try-restart)
+       if [ -f $LOCK_FILE ]; then
+               $0 stop
+               $0 start
+       fi
+       RETVAL=$?
+       ;;
+  status)
+       status $cmd
+       RETVAL=$?
+       ;;
+  *)
+       echo $"Usage: $0 {start|stop|restart|reload|force-reload|condrestart|try-restart|status}"
+       exit 2
+esac
+
+exit $RETVAL
index ef59c2a61f440ab59bb427a9272fcaf475f7ed64..e18511a03850b55b2d3bb9dcd60187e1cc3385f2 100644 (file)
@@ -1,10 +1,12 @@
 #!/bin/bash
-#
-# chkconfig: 2345 16 84
-# description: A BGPv4, BGPv4+, BGPv4- routing engine for use with Zebra
-#
-# processname: bgpd
-# config: /etc/zebra/bgpd.conf
+# chkconfig: - 16 84
+# config: /etc/quagga/bgpd.conf
+
+### BEGIN INIT INFO
+# Provides: bgpd
+# Short-Description: BGP routing engine
+# Description: BGP routing engine for use with Zebra
+### END INIT INFO
 
 # source function library
 . /etc/rc.d/init.d/functions
 # quagga command line options
 . /etc/sysconfig/quagga
 
-# Check that networking is up.
-[ "${NETWORKING}" = "no" ] && exit 0
-
-# The process must be configured first.
-[ -f /etc/quagga/bgpd.conf ] || exit 0
-
 RETVAL=0
-prog="bgpd"
+PROG="bgpd"
+cmd=bgpd
+LOCK_FILE=/var/lock/subsys/bgpd
+CONF_FILE=/etc/quagga/bgpd.conf
 
 case "$1" in
   start)
-       echo -n $"Starting $prog: "
-        daemon /usr/sbin/bgpd -d $BGPD_OPTS
+       # Check that networking is up.
+       [ "${NETWORKING}" = "no" ] && exit 1
+
+       # The process must be configured first.
+       [ -f $CONF_FILE ] || exit 6
+       if [ `id -u` -ne 0 ]; then
+               echo $"Insufficient privilege" 1>&2
+               exit 4
+       fi
+
+       echo -n $"Starting $PROG: "
+       daemon $cmd -d $BGPD_OPTS -f $CONF_FILE
        RETVAL=$?
-       [ $RETVAL -eq 0 ] && touch /var/lock/subsys/bgpd
+       [ $RETVAL -eq 0 ] && touch $LOCK_FILE
        echo
        ;;
   stop)
-       echo -n $"Shutting down $prog: "
-       killproc bgpd
+       echo -n $"Shutting down $PROG: "
+       killproc $cmd
        RETVAL=$?
-       [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/bgpd
+       [ $RETVAL -eq 0 ] && rm -f $LOCK_FILE
        echo
        ;;
-  restart|reload)
-        $0 stop
-        $0 start
+  restart|reload|force-reload)
+       $0 stop
+       $0 start
        RETVAL=$?
-        ;;
-  condrestart)
-        if [ -f /var/lock/subsys/bgpd ]; then
-                $0 stop
+       ;;
+  condrestart|try-restart)
+       if [ -f $LOCK_FILE ]; then
+               $0 stop
                $0 start
-        fi
+       fi
        RETVAL=$?
-        ;;
+       ;;
   status)
-        status bgpd
+       status $cmd
        RETVAL=$?
-        ;;
+       ;;
   *)
-       echo $"Usage: $0 {start|stop|restart|reload|condrestart|status}"
-       exit 1
+       echo $"Usage: $0 {start|stop|restart|reload|force-reload|condrestart|try-restart|status}"
+       exit 2
 esac
 
 exit $RETVAL
index 0d762c0430014f8f7f9593f475cedf864b126870..9e805300d346c6bde3504db14666bd65c9bf8217 100644 (file)
@@ -1,61 +1,72 @@
 #!/bin/bash
-#
-# chkconfig: 2345 16 84
-# description: An ISIS routing engine for use with Quagga
-#
-# processname: isisd
+# chkconfig: - 16 84
 # config: /etc/quagga/isisd.conf
 
+### BEGIN INIT INFO
+# Provides: isisd
+# Short-Description: IS-IS routing engine
+# Description: IS-IS routing engine for use with Zebra
+### END INIT INFO
+
 # source function library
 . /etc/rc.d/init.d/functions
 
 # Get network config
 . /etc/sysconfig/network
 
-# Check that networking is up.
-[ "${NETWORKING}" = "no" ] && exit 0
-
-# The process must be configured first.
-[ -f /etc/quagga/isisd.conf ] || exit 0
+# quagga command line options
+. /etc/sysconfig/quagga
 
 RETVAL=0
-
-prog="isisd"
+PROG="isisd"
+cmd=isisd
+LOCK_FILE=/var/lock/subsys/isisd
+CONF_FILE=/etc/quagga/isisd.conf
 
 case "$1" in
   start)
-       echo -n $"Starting $prog: "
-        daemon /usr/sbin/isisd -d
+       # Check that networking is up.
+       [ "${NETWORKING}" = "no" ] && exit 1
+
+       # The process must be configured first.
+       [ -f $CONF_FILE ] || exit 6
+       if [ `id -u` -ne 0 ]; then
+               echo $"Insufficient privilege" 1>&2
+               exit 4
+       fi
+
+       echo -n $"Starting $PROG: "
+       daemon $cmd -d $ISISD_OPTS -f $CONF_FILE
        RETVAL=$?
-       [ $RETVAL -eq 0 ] && touch /var/lock/subsys/isisd
+       [ $RETVAL -eq 0 ] && touch $LOCK_FILE
        echo
        ;;
   stop)
-       echo -n $"Shutting down $prog: "
-       killproc isisd
+       echo -n $"Shutting down $PROG: "
+       killproc $cmd
        RETVAL=$?
-       [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/isisd
+       [ $RETVAL -eq 0 ] && rm -f $LOCK_FILE
        echo
        ;;
-  restart|reload)
-        $0 stop
-        $0 start
+  restart|reload|force-reload)
+       $0 stop
+       $0 start
        RETVAL=$?
-        ;;
-  condrestart)
-        if [ -f /var/lock/subsys/isisd ]; then
-                $0 stop
+       ;;
+  condrestart|try-restart)
+       if [ -f $LOCK_FILE ]; then
+               $0 stop
                $0 start
-        fi
+       fi
        RETVAL=$?
-        ;;
+       ;;
   status)
-        status isisd
+       status $cmd
        RETVAL=$?
-        ;;
+       ;;
   *)
-       echo $"Usage: $0 {start|stop|restart|reload|condrestart|status}"
-       exit 1
+       echo $"Usage: $0 {start|stop|restart|reload|force-reload|condrestart|try-restart|status}"
+       exit 2
 esac
 
 exit $RETVAL
index c84ce678f34acbbfb63728b8ba5b5b4ed304af53..4133b4a14b942bdc7ba01ab9830981d372c53ac5 100644 (file)
@@ -1,11 +1,13 @@
 #!/bin/bash
-#
-# chkconfig: 2345 16 84
-# description: An OSPF routing engine for use with Zebra and IPv6
-#
-# processname: ospf6d
+# chkconfig: - 16 84
 # config: /etc/quagga/ospf6d.conf
 
+### BEGIN INIT INFO
+# Provides: ospf6d
+# Short-Description: OSPF routing engine for IPv6
+# Description: OSPF routing engine for use with Zebra and IPv6
+### END INIT INFO
+
 # source function library
 . /etc/rc.d/init.d/functions
 
 # quagga command line options
 . /etc/sysconfig/quagga
 
-# Check that networking is up.
-[ "${NETWORKING_IPV6}" = "no" ] && exit 0
-
-# The process must be configured first.
-[ -f /etc/quagga/ospf6d.conf ] || exit 0
-
 RETVAL=0
-prog="ospf6d"
+PROG="ospf6d"
+cmd=ospf6d
+LOCK_FILE=/var/lock/subsys/ospf6d
+CONF_FILE=/etc/quagga/ospf6d.conf
 
 case "$1" in
   start)
-       echo -n $"Starting $prog: "
-        daemon /usr/sbin/ospf6d -d $OSPF6D_OPTS
+       # Check that networking is up.
+       [ "${NETWORKING}" = "no" ] && exit 1
+
+       # The process must be configured first.
+       [ -f $CONF_FILE ] || exit 6
+       if [ `id -u` -ne 0 ]; then
+               echo $"Insufficient privilege" 1>&2
+               exit 4
+       fi
+
+       echo -n $"Starting $PROG: "
+       daemon $cmd -d $OSPF6D_OPTS -f $CONF_FILE
        RETVAL=$?
-       [ $RETVAL -eq 0 ] && touch /var/lock/subsys/ospf6d
+       [ $RETVAL -eq 0 ] && touch $LOCK_FILE
        echo
        ;;
   stop)
-       echo -n $"Shutting down $prog: "
-       killproc ospf6d
+       echo -n $"Shutting down $PROG: "
+       killproc $cmd
        RETVAL=$?
-       [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/ospf6d
+       [ $RETVAL -eq 0 ] && rm -f $LOCK_FILE
        echo
        ;;
-  restart|reload)
-        $0 stop
-        $0 start
+  restart|reload|force-reload)
+       $0 stop
+       $0 start
        RETVAL=$?
-        ;;
-  condrestart)
-        if [ -f /var/lock/subsys/ospf6d ]; then
-                $0 stop
+       ;;
+  condrestart|try-restart)
+       if [ -f $LOCK_FILE ]; then
+               $0 stop
                $0 start
-        fi
+       fi
        RETVAL=$?
-        ;;
+       ;;
   status)
-        status ospf6d
+       status $cmd
        RETVAL=$?
-        ;;
+       ;;
   *)
-       echo $"Usage: $prog {start|stop|restart|reload|condrestart|status}"
-       exit 1
+       echo $"Usage: $0 {start|stop|restart|reload|force-reload|condrestart|try-restart|status}"
+       exit 2
 esac
 
 exit $RETVAL
index 911f7aa59cf000008e26ba995222fb06a4b9487b..d964f38dffcfedda6423a96c5cc920fd084ab749 100644 (file)
@@ -1,11 +1,13 @@
 #!/bin/bash
-#
-# chkconfig: 2345 16 84
-# description: An OSPF v2 routing engine for use with Zebra
-#
-# processname: ospfd
+# chkconfig: - 16 84
 # config: /etc/quagga/ospfd.conf
 
+### BEGIN INIT INFO
+# Provides: ospfd
+# Short-Description: OSPF routing engine
+# Description: OSPF routing engine for use with Zebra
+### END INIT INFO
+
 # source function library
 . /etc/rc.d/init.d/functions
 
 # quagga command line options
 . /etc/sysconfig/quagga
 
-# Check that networking is up.
-[ "${NETWORKING}" = "no" ] && exit 0
-
-# The process must be configured first.
-[ -f /etc/quagga/ospfd.conf ] || exit 0
-
 RETVAL=0
-
-prog="ospfd"
+PROG="ospfd"
+cmd=ospfd
+LOCK_FILE=/var/lock/subsys/ospfd
+CONF_FILE=/etc/quagga/ospfd.conf
 
 case "$1" in
   start)
-       echo -n $"Starting $prog: "
-        daemon /usr/sbin/ospfd -d $OSPFD_OPTS
+       # Check that networking is up.
+       [ "${NETWORKING}" = "no" ] && exit 1
+
+       # The process must be configured first.
+       [ -f $CONF_FILE ] || exit 6
+       if [ `id -u` -ne 0 ]; then
+               echo $"Insufficient privilege" 1>&2
+               exit 4
+       fi
+
+       echo -n $"Starting $PROG: "
+       daemon $cmd -d $OSPFD_OPTS -f $CONF_FILE
        RETVAL=$?
-       [ $RETVAL -eq 0 ] && touch /var/lock/subsys/ospfd
+       [ $RETVAL -eq 0 ] && touch $LOCK_FILE
        echo
        ;;
   stop)
-       echo -n $"Shutting down $prog: "
-       killproc ospfd
+       echo -n $"Shutting down $PROG: "
+       killproc $cmd
        RETVAL=$?
-       [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/ospfd
+       [ $RETVAL -eq 0 ] && rm -f $LOCK_FILE
        echo
        ;;
-  restart|reload)
-        $0 stop
-        $0 start
+  restart|reload|force-reload)
+       $0 stop
+       $0 start
        RETVAL=$?
-        ;;
-  condrestart)
-        if [ -f /var/lock/subsys/ospfd ]; then
-                $0 stop
+       ;;
+  condrestart|try-restart)
+       if [ -f $LOCK_FILE ]; then
+               $0 stop
                $0 start
-        fi
+       fi
        RETVAL=$?
-        ;;
+       ;;
   status)
-        status ospfd
+       status $cmd
        RETVAL=$?
-        ;;
+       ;;
   *)
-       echo $"Usage: $0 {start|stop|restart|reload|condrestart|status}"
-       exit 1
+       echo $"Usage: $0 {start|stop|restart|reload|force-reload|condrestart|try-restart|status}"
+       exit 2
 esac
 
 exit $RETVAL
index 9e9da5ef3acba24a9e1390d94cf30609f58402cb..2befc0fdd4f1c71674faf1a48514dc744d942d44 100644 (file)
@@ -1,18 +1,19 @@
 #
 # Default: Bind all daemon vtys to the loopback(s) only
 #
-QCONFDIR="/etc/quagga"
-BGPD_OPTS="-A 127.0.0.1 -f ${QCONFDIR}/bgpd.conf"
-OSPF6D_OPTS="-A ::1 -f ${QCONFDIR}/ospf6d.conf"
-OSPFD_OPTS="-A 127.0.0.1 -f ${QCONFDIR}/ospfd.conf"
-RIPD_OPTS="-A 127.0.0.1 -f ${QCONFDIR}/ripd.conf"
-RIPNGD_OPTS="-A ::1 -f ${QCONFDIR}/ripngd.conf"
-ZEBRA_OPTS="-A 127.0.0.1 -f ${QCONFDIR}/zebra.conf"
-ISISD_OPTS="-A ::1 -f ${QCONFDIR}/isisd.conf"
+BABELD_OPTS="-A 127.0.0.1"
+BGPD_OPTS="-A 127.0.0.1"
+ISISD_OPTS="-A ::1"
+OSPF6D_OPTS="-A ::1"
+OSPFD_OPTS="-A 127.0.0.1"
+RIPD_OPTS="-A 127.0.0.1"
+RIPNGD_OPTS="-A ::1"
+ZEBRA_OPTS="-A 127.0.0.1"
 
-# Watchquagga configuration (please check timer values before using):
-WATCH_OPTS=""
-WATCH_DAEMONS="zebra bgpd ospfd ospf6d ripd ripngd"
-# To enable restarts, uncomment this line (but first be sure to edit
-# the WATCH_DAEMONS line to reflect the daemons you are actually using):
-#WATCH_OPTS="-Az -b_ -r/sbin/service_%s_restart -s/sbin/service_%s_start -k/sbin/service_%s_stop"
+# Watchquagga configuration
+#
+# Uncomment and edit this line to reflect the daemons you are actually using:
+#WATCH_DAEMONS="zebra bgpd ospfd ospf6d ripd ripngd"
+#
+# Timer values can be adjusting by editing this line:
+WATCH_OPTS="-Az -b_ -r/sbin/service_%s_restart -s/sbin/service_%s_start -k/sbin/service_%s_stop"
index 766422194d003f633a5e934d3f031b133ba1b30d..9b412cb9659e1c1e425e839cd70eb48d216befb8 100644 (file)
@@ -1,11 +1,13 @@
 #!/bin/bash
-#
-# chkconfig: 2345 16 84
-# description: A RIP routing engine for use with Zebra
-#
-# processname: ripd
+# chkconfig: - 16 84
 # config: /etc/quagga/ripd.conf
 
+### BEGIN INIT INFO
+# Provides: ripd
+# Short-Description: RIP routing engine
+# Description: RIP routing engine for use with Zebra
+### END INIT INFO
+
 # source function library
 . /etc/rc.d/init.d/functions
 
 # quagga command line options
 . /etc/sysconfig/quagga
 
-# Check that networking is up.
-[ "${NETWORKING}" = "no" ] && exit 0
-
-# The process must be configured first.
-[ -f /etc/quagga/ripd.conf ] || exit 0
-
 RETVAL=0
-prog="ripd"
+PROG="ripd"
+cmd=ripd
+LOCK_FILE=/var/lock/subsys/ripd
+CONF_FILE=/etc/quagga/ripd.conf
 
 case "$1" in
   start)
-       echo -n $"Starting $prog: "
-        daemon /usr/sbin/ripd -d $RIPD_OPTS
+       # Check that networking is up.
+       [ "${NETWORKING}" = "no" ] && exit 1
+
+       # The process must be configured first.
+       [ -f $CONF_FILE ] || exit 6
+       if [ `id -u` -ne 0 ]; then
+               echo $"Insufficient privilege" 1>&2
+               exit 4
+       fi
+
+       echo -n $"Starting $PROG: "
+       daemon $cmd -d $RIPD_OPTS -f $CONF_FILE
        RETVAL=$?
-       [ $RETVAL -eq 0 ] && touch /var/lock/subsys/ripd
+       [ $RETVAL -eq 0 ] && touch $LOCK_FILE
        echo
        ;;
   stop)
-       echo -n $"Shutting down $prog: "
-       killproc ripd
+       echo -n $"Shutting down $PROG: "
+       killproc $cmd
        RETVAL=$?
-       [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/ripd
+       [ $RETVAL -eq 0 ] && rm -f $LOCK_FILE
        echo
        ;;
-  restart|reload)
-        $0 stop
-        $0 start
+  restart|reload|force-reload)
+       $0 stop
+       $0 start
        RETVAL=$?
-        ;;
-  condrestart)
-        if [ -f /var/lock/subsys/ripd ]; then
-                $0 stop
+       ;;
+  condrestart|try-restart)
+       if [ -f $LOCK_FILE ]; then
+               $0 stop
                $0 start
-        fi
+       fi
        RETVAL=$?
-        ;;
+       ;;
   status)
-        status ripd
+       status $cmd
        RETVAL=$?
-        ;;
+       ;;
   *)
-       echo $"Usage: $0 {start|stop|restart|reload|condrestart|status}"
-       exit 1
+       echo $"Usage: $0 {start|stop|restart|reload|force-reload|condrestart|try-restart|status}"
+       exit 2
 esac
 
 exit $RETVAL
index 57ae928c72e9c0e78e3fe01fe2eae255da4d7658..88f346f86d54519d4d9b79c055678aab9ed621a9 100644 (file)
@@ -1,11 +1,13 @@
 #!/bin/bash
-#
-# chkconfig: 2345 16 84
-# description: A RIP routing engine for use with Zebra and IPv6
-#
-# processname: ripngd
+# chkconfig: - 16 84
 # config: /etc/quagga/ripngd.conf
 
+### BEGIN INIT INFO
+# Provides: ripngd
+# Short-Description: RIP routing engine for IPv6
+# Description: RIP routing engine for use with Zebra and IPv6
+### END INIT INFO
+
 # source function library
 . /etc/rc.d/init.d/functions
 
 # quagga command line options
 . /etc/sysconfig/quagga
 
-# Check that networking is up.
-[ "${NETWORKING_IPV6}" = "no" ] && exit 0
-
-# The process must be configured first.
-[ -f /etc/quagga/ripngd.conf ] || exit 0
-
 RETVAL=0
-prog="ripngd"
+PROG="ripngd"
+cmd=ripngd
+LOCK_FILE=/var/lock/subsys/ripngd
+CONF_FILE=/etc/quagga/ripngd.conf
 
 case "$1" in
   start)
-       echo -n $"Starting $prog: "
-        daemon /usr/sbin/ripngd -d $RIPNGD_OPTS
+       # Check that networking is up.
+       [ "${NETWORKING}" = "no" ] && exit 1
+
+       # The process must be configured first.
+       [ -f $CONF_FILE ] || exit 6
+       if [ `id -u` -ne 0 ]; then
+               echo $"Insufficient privilege" 1>&2
+               exit 4
+       fi
+
+       echo -n $"Starting $PROG: "
+       daemon $cmd -d $RIPNGD_OPTS -f $CONF_FILE
        RETVAL=$?
-       [ $RETVAL -eq 0 ] && touch /var/lock/subsys/ripngd
+       [ $RETVAL -eq 0 ] && touch $LOCK_FILE
        echo
        ;;
   stop)
-       echo -n $"Shutting down $prog: "
-       killproc ripngd
+       echo -n $"Shutting down $PROG: "
+       killproc $cmd
        RETVAL=$?
-       [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/ripngd
+       [ $RETVAL -eq 0 ] && rm -f $LOCK_FILE
        echo
        ;;
-  restart|reload)
-        $0 stop
-        $0 start
+  restart|reload|force-reload)
+       $0 stop
+       $0 start
        RETVAL=$?
-        ;;
-  condrestart)
-        if [ -f /var/lock/subsys/ripngd ]; then
-                $0 stop
+       ;;
+  condrestart|try-restart)
+       if [ -f $LOCK_FILE ]; then
+               $0 stop
                $0 start
-        fi
+       fi
        RETVAL=$?
-        ;;
+       ;;
   status)
-        status ripngd
+       status $cmd
        RETVAL=$?
-        ;;
+       ;;
   *)
-       echo $"Usage: $0 {start|stop|restart|reload|condrestart|status}"
-       exit 1
+       echo $"Usage: $0 {start|stop|restart|reload|force-reload|condrestart|try-restart|status}"
+       exit 2
 esac
 
 exit $RETVAL
index 74299e37364dd14192114ce0e2aca8f584b55b36..dda3506621545659a15abdb09f11d3deeb8fdd2c 100644 (file)
@@ -1,9 +1,11 @@
 #!/bin/bash
-#
 # chkconfig: 2345 17 83
-# description: A Quagga watchdog for use with Zebra
-#
-# processname: watchquagga
+
+### BEGIN INIT INFO
+# Provides: watchquagga
+# Short-Description: Quagga watchdog
+# Description: Quagga watchdog for use with Zebra
+### END INIT INFO
 
 # source function library
 . /etc/rc.d/init.d/functions
 # quagga command line options
 . /etc/sysconfig/quagga
 
-# Check that networking is up.
-[ "${NETWORKING}" = "no" ] && exit 0
-
-# Check that there are daemons to be monitored.
-[ -z "$WATCH_DAEMONS" ] && exit 0
-
 RETVAL=0
-prog="watchquagga"
+PROG="watchquagga"
+cmd=watchquagga
+LOCK_FILE=/var/lock/subsys/watchquagga
 
 case "$1" in
   start)
-       echo -n $"Starting $prog: "
-        daemon /usr/sbin/watchquagga -d $WATCH_OPTS $WATCH_DAEMONS
+       # Check that networking is up.
+       [ "${NETWORKING}" = "no" ] && exit 1
+
+       # Check that there are daemons to be monitored.
+       [ -z "$WATCH_DAEMONS" ] && exit 1
+
+       echo -n $"Starting $PROG: "
+       daemon $cmd -d $WATCH_OPTS $WATCH_DAEMONS
        RETVAL=$?
-       [ $RETVAL -eq 0 ] && touch /var/lock/subsys/watchquagga
+       [ $RETVAL -eq 0 ] && touch $LOCK_FILE
        echo
        ;;
   stop)
-       echo -n $"Shutting down $prog: "
-       killproc watchquagga
+       echo -n $"Shutting down $PROG: "
+       killproc $cmd
        RETVAL=$?
-       [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/watchquagga
+       [ $RETVAL -eq 0 ] && rm -f $LOCK_FILE
        echo
        ;;
-  restart|reload)
-        $0 stop
-        $0 start
+  restart|reload|force-reload)
+       $0 stop
+       $0 start
        RETVAL=$?
-        ;;
-  condrestart)
-        if [ -f /var/lock/subsys/watchquagga ]; then
-                $0 stop
+       ;;
+  condrestart|try-restart)
+       if [ -f $LOCK_FILE ]; then
+               $0 stop
                $0 start
-        fi
+       fi
        RETVAL=$?
-        ;;
+       ;;
   status)
-        status watchquagga
+       status $cmd
        RETVAL=$?
-        ;;
+       ;;
   *)
-       echo $"Usage: $0 {start|stop|restart|reload|condrestart|status}"
-       exit 1
+       echo $"Usage: $0 {start|stop|restart|reload|force-reload|condrestart|try-restart|status}"
+       exit 2
 esac
 
 exit $RETVAL
index 8caae1f167345cb9232bdfdd5ac9272c6fd5b9f8..4242b16c43a98f1ba295d97e0e8974775e957dbd 100644 (file)
@@ -1,64 +1,73 @@
 #!/bin/bash
-#
-# chkconfig: 2345 15 85
-# description: GNU Zebra routing manager
-#
-# processname: zebra
+# chkconfig: - 15 85
 # config: /etc/quagga/zebra.conf
 
+### BEGIN INIT INFO
+# Provides: zebra
+# Short-Description: GNU Zebra routing manager
+# Description: GNU Zebra routing manager
+### END INIT INFO
+
 # source function library
 . /etc/rc.d/init.d/functions
 
+# Get network config
+. /etc/sysconfig/network
+
 # quagga command line options
 . /etc/sysconfig/quagga
 
-# Check that networking is up.
-[ "${NETWORKING}" = "no" ] && exit 0
-
-# The process must be configured first.
-[ -f /etc/quagga/zebra.conf ] || exit 0
-
 RETVAL=0
-
-prog="zebra"
+PROG="zebra"
+cmd=zebra
+LOCK_FILE=/var/lock/subsys/zebra
+CONF_FILE=/etc/quagga/zebra.conf
 
 case "$1" in
   start)
-       echo -n $"Starting $prog: "
+       # Check that networking is up.
+       [ "${NETWORKING}" = "no" ] && exit 1
 
+       # The process must be configured first.
+       [ -f $CONF_FILE ] || exit 6
+       if [ `id -u` -ne 0 ]; then
+               echo $"Insufficient privilege" 1>&2
+               exit 4
+       fi
+
+       echo -n $"Starting $PROG: "
        /sbin/ip route flush proto zebra
-                       
-        daemon /usr/sbin/zebra -d $ZEBRA_OPTS
+       daemon $cmd -d $ZEBRA_OPTS -f $CONF_FILE
        RETVAL=$?
-       [ $RETVAL -eq 0 ] && touch /var/lock/subsys/zebra
+       [ $RETVAL -eq 0 ] && touch $LOCK_FILE
        echo
        ;;
   stop)
-       echo -n $"Shutting down $prog: "
-       killproc zebra
+       echo -n $"Shutting down $PROG: "
+       killproc $cmd
        RETVAL=$?
-       [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/zebra
+       [ $RETVAL -eq 0 ] && rm -f $LOCK_FILE
        echo
        ;;
-  restart|reload)
-        $0 stop
-        $0 start
+  restart|reload|force-reload)
+       $0 stop
+       $0 start
        RETVAL=$?
-        ;;
-  condrestart)
-        if [ -f /var/lock/subsys/zebra ]; then
-                $0 stop
+       ;;
+  condrestart|try-restart)
+       if [ -f $LOCK_FILE ]; then
+               $0 stop
                $0 start
-        fi
+       fi
        RETVAL=$?
-        ;;
+       ;;
   status)
-        status zebra
+       status $cmd
        RETVAL=$?
-        ;;
+       ;;
   *)
-       echo $"Usage: $0 {start|stop|restart|reload|condrestart|status}"
-       exit 1
+       echo $"Usage: $0 {start|stop|restart|reload|force-reload|condrestart|try-restart|status}"
+       exit 2
 esac
 
 exit $RETVAL