|
cvsdist |
2f7f4b |
#!/bin/bash
|
|
cvsdist |
2f7f4b |
#
|
|
cvsdist |
2f7f4b |
# named This shell script takes care of starting and stopping
|
|
cvsdist |
2f7f4b |
# named (BIND DNS server).
|
|
cvsdist |
2f7f4b |
#
|
|
cvsdist |
2f7f4b |
# chkconfig: - 55 45
|
|
cvsdist |
2f7f4b |
# description: named (BIND) is a Domain Name Server (DNS) \
|
|
cvsdist |
2f7f4b |
# that is used to resolve host names to IP addresses.
|
|
cvsdist |
2f7f4b |
# probe: true
|
|
cvsdist |
2f7f4b |
|
|
cvsdist |
2f7f4b |
# Source function library.
|
|
cvsdist |
2f7f4b |
. /etc/rc.d/init.d/functions
|
|
cvsdist |
2f7f4b |
|
|
cvsdist |
2f7f4b |
# Source networking configuration.
|
|
cvsdist |
2f7f4b |
. /etc/sysconfig/network
|
|
cvsdist |
2f7f4b |
|
|
cvsdist |
2f7f4b |
# Check that networking is up.
|
|
cvsdist |
2f7f4b |
[ ${NETWORKING} = "no" ] && exit 0
|
|
cvsdist |
2f7f4b |
|
|
cvsdist |
2f7f4b |
[ -f /usr/sbin/named ] || exit 0
|
|
cvsdist |
2f7f4b |
|
|
cvsdist |
2f7f4b |
[ -f /etc/named.conf ] || exit 0
|
|
cvsdist |
2f7f4b |
|
|
cvsdist |
2f7f4b |
RETVAL=0
|
|
cvsdist |
2f7f4b |
|
|
cvsdist |
2f7f4b |
start() {
|
|
cvsdist |
2f7f4b |
# Start daemons.
|
|
cvsdist |
2f7f4b |
echo -n "Starting named: "
|
|
cvsdist |
2f7f4b |
daemon named -u named
|
|
cvsdist |
2f7f4b |
RETVAL=$?
|
|
cvsdist |
2f7f4b |
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/named
|
|
cvsdist |
2f7f4b |
echo
|
|
cvsdist |
2f7f4b |
return $RETVAL
|
|
cvsdist |
2f7f4b |
}
|
|
cvsdist |
2f7f4b |
stop() {
|
|
cvsdist |
2f7f4b |
# Stop daemons.
|
|
cvsdist |
2f7f4b |
echo -n "Shutting down named: "
|
|
cvsdist |
2f7f4b |
killproc named
|
|
cvsdist |
2f7f4b |
RETVAL=$?
|
|
cvsdist |
2f7f4b |
[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/named
|
|
cvsdist |
2f7f4b |
echo
|
|
cvsdist |
2f7f4b |
return $RETVAL
|
|
cvsdist |
2f7f4b |
}
|
|
cvsdist |
2f7f4b |
rhstatus() {
|
|
cvsdist |
2f7f4b |
/usr/sbin/ndc status
|
|
cvsdist |
2f7f4b |
return $?
|
|
cvsdist |
2f7f4b |
}
|
|
cvsdist |
2f7f4b |
restart() {
|
|
cvsdist |
2f7f4b |
stop
|
|
cvsdist |
2f7f4b |
start
|
|
cvsdist |
2f7f4b |
}
|
|
cvsdist |
2f7f4b |
reload() {
|
|
cvsdist |
2f7f4b |
/usr/sbin/ndc reload
|
|
cvsdist |
2f7f4b |
return $?
|
|
cvsdist |
2f7f4b |
}
|
|
cvsdist |
2f7f4b |
probe() {
|
|
cvsdist |
2f7f4b |
# named knows how to reload intelligently; we don't want linuxconf
|
|
cvsdist |
2f7f4b |
# to offer to restart every time
|
|
cvsdist |
2f7f4b |
/usr/sbin/ndc reload >/dev/null 2>&1 || echo start
|
|
cvsdist |
2f7f4b |
return $?
|
|
cvsdist |
2f7f4b |
}
|
|
cvsdist |
2f7f4b |
|
|
cvsdist |
2f7f4b |
# See how we were called.
|
|
cvsdist |
2f7f4b |
case "$1" in
|
|
cvsdist |
2f7f4b |
start)
|
|
cvsdist |
2f7f4b |
start
|
|
cvsdist |
2f7f4b |
;;
|
|
cvsdist |
2f7f4b |
stop)
|
|
cvsdist |
2f7f4b |
stop
|
|
cvsdist |
2f7f4b |
;;
|
|
cvsdist |
2f7f4b |
status)
|
|
cvsdist |
2f7f4b |
rhstatus
|
|
cvsdist |
2f7f4b |
;;
|
|
cvsdist |
2f7f4b |
restart)
|
|
cvsdist |
2f7f4b |
restart
|
|
cvsdist |
2f7f4b |
;;
|
|
cvsdist |
2f7f4b |
condrestart)
|
|
cvsdist |
2f7f4b |
[ -f /var/lock/subsys/named ] && restart || :
|
|
cvsdist |
2f7f4b |
;;
|
|
cvsdist |
2f7f4b |
reload)
|
|
cvsdist |
2f7f4b |
reload
|
|
cvsdist |
2f7f4b |
;;
|
|
cvsdist |
2f7f4b |
probe)
|
|
cvsdist |
2f7f4b |
probe
|
|
cvsdist |
2f7f4b |
;;
|
|
cvsdist |
2f7f4b |
*)
|
|
cvsdist |
2f7f4b |
echo "Usage: named {start|stop|status|restart|condrestart|reload|probe}"
|
|
cvsdist |
2f7f4b |
exit 1
|
|
cvsdist |
2f7f4b |
esac
|
|
cvsdist |
2f7f4b |
|
|
cvsdist |
2f7f4b |
exit $?
|
|
cvsdist |
2f7f4b |
|