Listing 1: NS shell script
#!/bin/sh
if [ "$#" -eq 0 ]
then
echo
echo the syntax of the NS command is:
echo
echo " NS debug ON debugging-level - set the debugging level"
echo " NS debug OFF - turn off debugging"
echo ""
echo " NS dump - dump the database"
echo " NS reload - reload the database"
exit
fi
count=$#
arg1=$1
arg2=$2
arg3=$3
case "$1"
in
debug ) echo setting the debug
case "$2"
in
on ) echo set debbugging on at $3
if [ "$arg3" -eq "" ]
then
count=1
else
count=$arg3
fi
echo increasing the debug level by $count
while [ "$count" -gt 0 ]
do
kill -USR1 `cat /etc/named.pid`
count=`expr $count - 1`
done
;;
off ) echo set debugging off
kill -USR2 `cat /etc/named.pid`
;;
esac
;;
dump ) echo Dumping the database, see /usr/tmp/named_dump.db
kill -INT `cat /etc/named.pid`
;;
reload ) echo Reloading the database......
kill -HUP `cat /etc/named.pid`
;;
esac
|