summaryrefslogtreecommitdiff
path: root/redhat/ospf6d.init
diff options
context:
space:
mode:
Diffstat (limited to 'redhat/ospf6d.init')
-rw-r--r--redhat/ospf6d.init71
1 files changed, 40 insertions, 31 deletions
diff --git a/redhat/ospf6d.init b/redhat/ospf6d.init
index c84ce678..4133b4a1 100644
--- a/redhat/ospf6d.init
+++ b/redhat/ospf6d.init
@@ -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
@@ -15,49 +17,56 @@
# 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