Hi.
Here's my proposal for the bind sysv script, very useful if used with a debug
log channel, other daily stuff and otherwise neat and handy functions. Patch
attached.
Have fun!
--
Regards // Oden Eriksson, Deserve-IT.com
--- named.init 2002-02-15 18:23:28.000000000 +0100
+++ /etc/rc.d/init.d/named 2003-03-31 16:17:04.000000000 +0200
@@ -7,6 +7,8 @@
# description: named (BIND) is a Domain Name Server (DNS) \
# that is used to resolve host names to IP addresses.
# probe: true
+#
+# enhanced for bind 9.2.2 usage Mon 31 Mar 2003 by Oden Eriksson
# Source function library.
. /etc/rc.d/init.d/functions
@@ -28,7 +30,7 @@
start() {
# Start daemons.
- gprintf "Starting %s: " $prog
+ echo -n "Starting named:"
if [ -n "${ROOTDIR}" -a "x${ROOTDIR}" != "x/" ]; then
OPTIONS="${OPTIONS} -t ${ROOTDIR}"
fi
@@ -40,7 +42,7 @@
}
stop() {
# Stop daemons.
- gprintf "Stopping %s: " $prog
+ echo -n "Stopping named:"
killproc named
RETVAL=$?
[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/named
@@ -56,7 +58,35 @@
start
}
reload() {
- /usr/sbin/rndc -c ${ROOTDIR}/etc/rndc.conf reload >/dev/null 2>&1 || /usr/bin/killall -HUP named
+ /usr/sbin/rndc -c ${ROOTDIR}/etc/rndc.conf reload $1 $2 $3>/dev/null 2>&1 || /usr/bin/killall -HUP named
+ return $?
+}
+refresh() {
+ /usr/sbin/rndc -c ${ROOTDIR}/etc/rndc.conf refresh $1 $2 $3>/dev/null 2>&1 || /usr/bin/killall -HUP named
+ return $?
+}
+reload_cache() {
+ for i in `cat ${ROOTDIR}/var/tmp/names_dump.db`; do
+ echo -n "Loading: ${i}...: "
+ dig ${i} >/dev/null 2>&1
+ echo "done"
+ done
+ return $?
+}
+flush() {
+ /usr/sbin/rndc -c ${ROOTDIR}/etc/rndc.conf flush $1>/dev/null 2>&1 || /usr/bin/killall -HUP named
+ return $?
+}
+debug() {
+ /usr/sbin/rndc -c ${ROOTDIR}/etc/rndc.conf trace 3
+ return $?
+}
+dumpdb() {
+ /usr/sbin/rndc -c ${ROOTDIR}/etc/rndc.conf dumpdb
+ grep "^[a-z].[a-z]" ${ROOTDIR}/var/tmp/named_dump.db|\
+ awk '{print $1}'|tr A-Z a-z|sort|uniq>${ROOTDIR}/var/tmp/names_dump.db
+ no_names=`cat ${ROOTDIR}/var/tmp/names_dump.db|wc -l|tr -d [:space:]`
+ echo "There's ${no_names} entries in the cache"
return $?
}
probe() {
@@ -86,13 +116,27 @@
reload)
reload
;;
+ refresh)
+ refresh
+ ;;
+ reload_cache)
+ reload_cache
+ ;;
+ flush)
+ flush
+ ;;
+ debug)
+ debug
+ ;;
+ dumpdb)
+ dumpdb
+ ;;
probe)
probe
;;
*)
- gprintf "Usage: %s {start|stop|status|restart|condrestart|reload|probe}\n" $0
+ echo "Usage: named {start|stop|status|restart|condrestart|reload|refresh|reload_cache|flush|debug|dumpdb|probe}"
exit 1
esac
exit $?
-