fea33a3
#!/bin/bash
fea33a3
#
fea33a3
# nsd:         Starts the NSD Name Server Daemon
fea33a3
#
fea33a3
# chkconfig: - 11 89
fea33a3
# description:  NSD is a complete implementation of an authoritative \
fea33a3
#               DNS name server. 
fea33a3
# processname: /usr/sbin/nsd
fea33a3
# config: /etc/nsd/nsdc.config
fea33a3
#
fea33a3
### BEGIN INIT INFO
fea33a3
# Provides: nsd
fea33a3
# Required-Start: $syslog
fea33a3
# Default-Stop: 0 11 89
fea33a3
# Short-Description: Starts the NSD Name Server Daemon
fea33a3
# Description:  NSD is a complete implementation of an authoritative \
fea33a3
#               DNS name server.
fea33a3
### END INIT INFO
fea33a3
fea33a3
# Sanity checks.
fea33a3
[ -f /etc/nsd/nsdc.conf ] || exit 0
fea33a3
[ -f /etc/nsd/nsd.zones ] || exit 0
fea33a3
[ -x /usr/sbin/nsd ] || exit 0
fea33a3
fea33a3
#extra verbosity
fea33a3
#ZONEC_VERBOSE=-v
fea33a3
OTHER_NSD_OPTS=""
fea33a3
2979b81
#fixed in 2.3.6
289fb2f
#work around for bug in nsd-2.3.x when no ipv6 is available
2979b81
#if [ ! -d /proc/sys/net/ipv6/ ]
2979b81
#then
2979b81
#        OTHER_NSD_OPTS="-4 $OTHER_NSD_OPTS"
2979b81
#fi
c025ce8
fea33a3
# Source function library.
fea33a3
. /etc/init.d/functions
fea33a3
fea33a3
. /etc/sysconfig/network
fea33a3
fea33a3
# Check that networking is configured.
fea33a3
[ ${NETWORKING} = "no" ] && exit 0
fea33a3
fea33a3
start() {
fea33a3
	/usr/sbin/nsdc rebuild >/dev/null
fea33a3
	/usr/sbin/nsdc update >/dev/null
fea33a3
	echo -n $"Starting nsd... "
fea33a3
	nsd $OTHER_NSD_OPTS
fea33a3
	RETVAL=$?
fea33a3
	echo
fea33a3
	/usr/sbin/nsdc notify
fea33a3
	touch /var/lock/subsys/nsd
fea33a3
	return $RETVAL
fea33a3
}
fea33a3
fea33a3
stop() {
fea33a3
	echo -n $"Shutting down nsd services: "
fea33a3
	killproc nsd
fea33a3
	RETVAL=$?
fea33a3
	if [ $RETVAL -eq 0 ] ; then
fea33a3
	  rm -f /var/lock/subsys/nsd
fea33a3
	  rm -f /var/run/nsd.pid
fea33a3
	fi
fea33a3
	echo
fea33a3
	return $RETVAL
fea33a3
}
fea33a3
fea33a3
restart() {
fea33a3
	stop
fea33a3
	start
fea33a3
}
fea33a3
fea33a3
RETVAL=0
fea33a3
fea33a3
# See how we were called.
fea33a3
case "$1" in
fea33a3
  start)
fea33a3
	start
fea33a3
	;;
fea33a3
  stop)
fea33a3
	stop
fea33a3
	;;
fea33a3
  restart)
fea33a3
	restart
fea33a3
	;;
fea33a3
  condrestart)
fea33a3
        [ -f /var/lock/subsys/nsd ] && restart || :
fea33a3
	;;
fea33a3
  status)
fea33a3
	/usr/sbin/nsdc running
fea33a3
	;;
fea33a3
  stats|reload|rebuild|running|update|notify)
fea33a3
	/usr/sbin/nsdc $1 
fea33a3
	;;
fea33a3
  *)
fea33a3
	echo $"Usage: $0 {start|stop|status|restart|condrestart|stats|notify|reload|rebuild|running|update}"
fea33a3
	exit 1
fea33a3
esac
fea33a3
fea33a3
exit $?