File: //etc/rc.d/rc2.d/K89nsd
#!/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/nsd.conf
#
### 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/nsd.conf ] || exit 1
[ -x /usr/sbin/nsd ] || exit 1
if [ -e "/etc/SuSE-release" ]; then
SUSE=1
DAEMONIZE=''
RESULT='done'
else
REDHAT=1
DAEMONIZE='daemon'
RESULT=''
fi
if [ "$REDHAT" = "1" ]; then
# Source function library.
if [ -e "/etc/init.d/functions" ]; then
. /etc/init.d/functions
else
if [ -e "/etc/rc.d/init.d/functions" ]; then
. /etc/rc.d/init.d/functions
fi
fi
# Source networking configuration
if [ -f /etc/sysconfig/network ]; then
. /etc/sysconfig/network
fi
# Networking check is different for SuSE so moved check here
# Check that networking is up for Red Hat
[ ${NETWORKING} = "no" ] && exit 0
fi
if [ "$SUSE" = "1" ]; then
# Source rc status functions
. /etc/rc.status
# Source networking functions
#. /etc/sysconfig/network/scripts/functions
fi
#extra verbosity
#ZONEC_VERBOSE=-v
OTHER_NSD_OPTS=""
start() {
/usr/sbin/nsdc rebuild >/dev/null 2>&1
echo -n $"Starting nsd: "
if [ -n "`/sbin/pidof -o %PPID nsd`" ]; then
echo -n $"nsd: already running"
failure
echo
return 1
fi
$DAEMONIZE nsd $OTHER_NSD_OPTS
RETVAL=$?
echo
touch /var/lock/subsys/nsd
return $RETVAL
}
stop() {
echo -n $"Shutting down nsd services: "
/usr/sbin/nsdc stop
RETVAL=$?
if [ $RETVAL -eq 0 ] ; then
rm -f /var/run/nsd/nsd.pid
# ensure notifies are sent at startup
rm -f /var/lib/nsd/xfrd.state
rm -f /var/lock/subsys/nsd
fi
echo
return $RETVAL
}
restart() {
stop
start
}
#/usr/sbin/nsdc running
RETVAL=0
# See how we were called.
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
restart
;;
condrestart)
[ -f /var/lock/subsys/nsd ] && restart || :
;;
status)
if [ "$SUSE" = "1" ]; then
echo -n nsd
rc_status -v
else
status nsd
fi
;;
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 $?