home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
rtsi.com
/
2014.01.www.rtsi.com.tar
/
www.rtsi.com
/
OS9
/
OSK
/
NETWORK
/
ISP
/
bind.4.8.3.lzh
/
BIND483
/
EXAMPLES
/
ch07.get_cache.sh
< prev
next >
Wrap
Linux/UNIX/POSIX Shell Script
|
1994-01-09
|
623b
|
39 lines
#!/bin/sh
ROOT=terp.umd.edu.
TMPFILE=/tmp/ns.$$
CACHETMP=/tmp/db.cache.tmp
#
# Look up root server information and store it in a temporary file.
#
nslookup >$TMPFILE <<-EOF
server $ROOT
set type=ns
.
EOF
#
# Generate the the db.cache file from the nslookup output. Store
# it in a temporary file.
#
cat $TMPFILE | awk '
/(root)/ {printf "%-20s 99999999 IN NS %s.\n", ".", $NF}
/address/ {printf "%-20s 99999999 IN A %s\n", $1 ".", $NF}
' > $CACHETMP
#
# Move the new db.cache in place if it is not empty.
#
if test -s $CACHETMP
then
mv $CACHETMP db.cache
else
rm $CACHETMP
fi
#
# Clean up.
#
rm $TMPFILE