Paul Wouters
2005-Oct-12 22:48 UTC
updated version of nsd.init for redhat/fedora startup script
Attached is an updated nsd.init. It redirects more output to /dev/null so that the startup happens with the proper printing of "OK" instead of a bunch of statistics that the enduser does not want to know. It also hides the or obscure nsd-xfer error codes that are not documented anywhere, such as: nsd-xfer[21425]: error: error response 5 Paul -- "Happiness is never grand" --- Mustapha Mond, World Controller (Brave New World) -------------- next part -------------- #!/bin/bash # # nsd: Starts the NSD Name Server Daemon # # chkconfig: - 11 89 # description: NSD is a complete implementation of an authoritative \ # DNS name server. # processname: /usr/sbin/nsd # config: /etc/nsd/nsdc.config # ### 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. ### END INIT INFO # Sanity checks. [ -f /etc/nsd/nsdc.conf ] || exit 0 [ -f /etc/nsd/nsd.zones ] || exit 0 [ -x /usr/sbin/nsd ] || exit 0 #extra verbosity #ZONEC_VERBOSE=-v OTHER_NSD_OPTS="-a 193.110.157.135" # Source function library. . /etc/init.d/functions . /etc/sysconfig/network # Check that networking is configured. [ ${NETWORKING} = "no" ] && exit 0 start() { echo -n $"Starting nsd: " /usr/sbin/nsdc rebuild >/dev/null 2>/dev/null /usr/sbin/nsdc update >/dev/null 2>/dev/null daemon nsd $OTHER_NSD_OPTS RETVAL=$? echo /usr/sbin/nsdc notify >/dev/null 2>/dev/null [ $RETVAL -eq 0 ] && touch /var/lock/subsys/nsd return $RETVAL } stop() { echo -n $"Shutting down nsd services: " killproc nsd RETVAL=$? if [ $RETVAL -eq 0 ] ; then rm -f /var/lock/subsys/nsd rm -f /var/run/nsd.pid fi echo return $RETVAL } restart() { stop start } RETVAL=0 # See how we were called. case "$1" in start) start ;; stop) stop ;; restart) restart ;; condrestart) [ -f /var/lock/subsys/nsd ] && restart || : ;; status) /usr/sbin/nsdc running ;; stats|reload|rebuild|running|update|notify) /usr/sbin/nsdc $1 ;; *) echo $"Usage: $0 {start|stop|status|restart|condrestart|stats|notify|reload|rebuild|running|update}" exit 1 esac exit $?