From c84fed820b42cb6db870ebfdb6fe72053f88c9ad Mon Sep 17 00:00:00 2001 From: Paul Wouters Date: Nov 10 2008 04:51:54 +0000 Subject: updated nsd.init file to be more LSB compliant --- diff --git a/nsd.init b/nsd.init index 304cf37..d0eb730 100755 --- a/nsd.init +++ b/nsd.init @@ -2,7 +2,7 @@ # # nsd: Starts the NSD Name Server Daemon # -# chkconfig: - 11 89 +# chkconfig: - 13 87 # description: NSD is a complete implementation of an authoritative \ # DNS name server. # processname: /usr/sbin/nsd @@ -10,50 +10,62 @@ # ### BEGIN INIT INFO # Provides: nsd -# Required-Start: $syslog -# Default-Stop: 0 11 89 -# Short-Description: Starts the NSD Name Server Daemon -# Description: NSD is a complete implementation of an authoritative \ -# DNS name server. +# Required-Start: $local_fs $network $syslog +# Required-Stop: $local_fs $network $syslog +# Default-Start: +# Short-Description: start|stop|status|restart|try-restart|reload|force-reload DNS server +# Description: control NSD implementation of DNS server ### END INIT INFO -# Sanity checks. -[ -f /etc/nsd/nsd.conf ] || exit 0 -[ -x /usr/sbin/nsd ] || exit 0 - #extra verbosity #ZONEC_VERBOSE=-v OTHER_NSD_OPTS="" # Source function library. -. /etc/init.d/functions +. /etc/rc.d/init.d/functions -. /etc/sysconfig/network +[ -r /etc/sysconfig/nsd ] && . /etc/sysconfig/nsd # Check that networking is configured. [ ${NETWORKING} = "no" ] && exit 0 start() { - echo -n $"Starting nsd... " + # Source networking configuration. + [ -r /etc/sysconfig/network ] && . /etc/sysconfig/network + + # Check that networking is up + [ "${NETWORKING}" = "no" ] && exit 1 + + # Sanity checks. + [ -f /etc/nsd/nsd.conf ] || exit 5 + [ -x /usr/sbin/nsd ] || exit 5 + + echo -n $"Starting nsd:" /usr/sbin/nsdc rebuild >/dev/null 2>%1 nsd $OTHER_NSD_OPTS RETVAL=$? echo - touch /var/lock/subsys/nsd - return $RETVAL + if [ $RETVAL -eq 0 ]; then + touch /var/lock/subsys/named; + else + exit 7; + fi + return 0; } stop() { - echo -n $"Shutting down nsd services: " + echo -n $"Stopping nsd: " # save state to zonefiles /usr/sbin/nsdc patch > /dev/null 2>%1 - killproc nsd + /usr/sbin/nsdc stop RETVAL=$? + # was nsdc successful? + [ "$RETVAL" -eq 0 ] || killproc nsd -TERM >/dev/null 2>&1 if [ $RETVAL -eq 0 ] ; then rm -f /var/run/nsd/nsd.pid + rm -f /var/lock/subsys/nsd # ensure notifies are sent at startup rm -f /var/lib/nsd/xfrd.state - rm -f /var/lock/subsys/nsd fi echo return $RETVAL @@ -91,4 +103,4 @@ case "$1" in exit 1 esac -exit $? +exit $RETVAL