⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 cachebuild.shar

📁 早期freebsd实现
💻 SHAR
字号:
#Message-Id: <199304292351.AA06468@rainbow.cse.nau.edu>#From: root@rainbow.cse.nau.edu (System Administrator)#Date: Thu, 29 Apr 1993 16:51:57 MST#To: vixie#Subject: Re: send me your tools##Here's a little tool I wrote for Bind, you can include it in the#"contrib" area of 4.9.X if you want.  It builds a new root cache file#for you, by querying any root name server it can still talk to.#Sorta nice for automation, like for sites that don't have a full-time#network administrator.##I haven't tried it out under Bind 4.9, just 4.8.3.#You might give it a go -- hopefully no modifications will be necessary.#Below is the "shar" archive.  No man-page, just a complete README.##                                                -- paul balyoz##! /bin/sh# This is a shell archive.  Remove anything before this line, then unpack# it by saving it into a file and typing "sh file".  To overwrite existing# files, type "sh file -c".  You can also feed this as standard input via# unshar, or by typing "sh <file", e.g..  If this archive is complete, you# will see the following message at the end:#		"End of shell archive."# Contents:  README Makefile cachebuild.SH cachebuild.awk# Wrapped by root@rainbow on Sun Apr 18 20:42:47 1993PATH=/bin:/usr/bin:/usr/ucb ; export PATHif test -f 'README' -a "${1}" != "-c" ; then   echo shar: Will not clobber existing file \"'README'\"elseecho shar: Extracting \"'README'\" \(2963 characters\)sed "s/^X//" >'README' <<'END_OF_FILE'XX			CACHE BUILD PROGRAMXXDESCRIPTION:XXThis utility will build the latest root domain server cache for yourXBIND nameserver data base, by running nslookup to query one of the knownXroot domain servers, and passing the output through an awk script toXgenerate the file.  Simple, really.XXOf course, your name server's current root.cache must have at leastXONE working root domain server and its address, or you can't get toXa root server to ask about other root servers.  (But then, you'd knowXit by now, your nameserver wouldn't be working!)  This will build a moreXup-to-date root.cache than the one that comes with the BIND distribution.XXRun cachebuild every month or two to keep your nameserver up to date.XYou can run it from cron if you're brave.XXCachebuild should NOT be run on root name servers themselves --Xthose sites are much too important to trust automated software!XCachebuild is intended to be used by normal Internet sites.XXHOW IT WORKS:XXThe file "root.cache" is created in your currently directory whenXcachebuild is run.  Don't worry though, if there's an existing fileXby that name it will be moved to "root.cache.old" (and similarly,Xan existing file by that name is moved to "root.cache.older").XXThere's no guarantee that the output from this program is correct;Xafter you generate a new root.cache file, examine it carefully andXcompare it with your old one.  Keep your old root.cache files around,Xjust in case!XXThe only challenge is adjusting the awk script to work with the versionXof BIND that you happen to have installed.  The awk script includedXworks with nslookup from BIND version 4.8.3 and from SunOS 4.1.3.XYou can modify it as needed.XXINSTALLATION:XX1.  Edit the Makefile to make any modifications for your local site.X2.  Type "make" to build the shell script cachebuild.X3.  Type "make install" to install the program and awk script.X4.  Move into a safe place (cd /tmp) and try running cachebuild.X    If you use the C-shell, you may need to type "rehash" first.X    Cachebuild should create the file root.cache in your currentX    directory.  Examine it.X5.  If all is OK, you can safely run it in your name-server directoryX    or just copy the new root.cache over there.X    If not, fix it, "make clean" and try again.XXERROR MESSAGES:XXIf it succeeds, cachebuild will return the usual exit status of 0.XThe only error message cachebuild generates is:XX		Call to nslookup failed.XXwhich means that nslookup exited with a non-zero status valueX(indicating an error of some sort).  Error messages from nslookupXthat are sent to stderr will come out on stderr from cachebuild, too.XXCOMPLAINTS DEPT:XXYea, I know, I should rewrite it in perl.  ENOTIME.XX--XPaul Balyoz, Senior Systems Programmer  pab@rainbow.cse.nau.eduXNorthern Arizona University             root@naucse.cse.nau.eduXPO Box 15600, Flagstaff AZ 86011        {pab,root}@sunset.cse.nau.eduXNICname: PB1                            ...arizona!naucse!rootEND_OF_FILEif test 2963 -ne `wc -c <'README'`; then    echo shar: \"'README'\" unpacked with wrong size!fi# end of 'README'fiif test -f 'Makefile' -a "${1}" != "-c" ; then   echo shar: Will not clobber existing file \"'Makefile'\"elseecho shar: Extracting \"'Makefile'\" \(713 characters\)sed "s/^X//" >'Makefile' <<'END_OF_FILE'X#X# Makefile for the CACHE BUILD package.X#XX# where to put the main executable shell scriptXBIN=/usr/com/binXX# where to put the awk script  (note: change this in cachebuild, too!)XLIB=/usr/com/libXX# name of root.cache type output fileXCACHEFILE=root.cacheXX# Note: fix PATH variable in cachebuild.SH script before building.XXXall:	cachebuildXXcachebuild:	cachebuild.SHX	echo "s,CBAWKPATH,$(LIB)/cachebuild.awk,g" > fix.sedX	echo "s,CACHEFILE,$(CACHEFILE),g" >> fix.sedX	sed -f fix.sed < cachebuild.SH > cachebuildX	rm -f fix.sedX	chmod 755 cachebuildXXinstall:	allX	install -c -m 755 -o bin -g bin cachebuild $(BIN)X	install -c -m 644 -o bin -g bin cachebuild.awk $(LIB)XXclean:X	-rm -f cachebuild root.cache*END_OF_FILEif test 713 -ne `wc -c <'Makefile'`; then    echo shar: \"'Makefile'\" unpacked with wrong size!fi# end of 'Makefile'fiif test -f 'cachebuild.SH' -a "${1}" != "-c" ; then   echo shar: Will not clobber existing file \"'cachebuild.SH'\"elseecho shar: Extracting \"'cachebuild.SH'\" \(913 characters\)sed "s/^X//" >'cachebuild.SH' <<'END_OF_FILE'X#!/bin/shX#		ROOT CACHE PROGRAMX#	By Paul Balyoz <pab@rainbow.cse.nau.edu>  03/15/91X#XX# Name of file to write the new root cache intoXOUT="CACHEFILE"XX# Front part of the name of the awk script we need to runXAWKSCR="CBAWKPATH"XX# This must include the directory where "nslookup" livesXPATH=/usr/ucb:/bin:/usr/bin:/usr/etc:/usr/local/bin:/usr/com/binXexport PATHXX# --------------------------------------------------------------------------XXrm -f $OUT.olderXif test -f $OUT.old; thenX	mv $OUT.old $OUT.olderXfiXif test -f $OUT; thenX	mv $OUT $OUT.oldXfiXXecho ";" > $OUTXecho "; root.cache built by $USER@`hostname` on `date`" >> $OUTXecho "; Automatically built by cachebuild, any changes you make may go away." >> $OUTXecho ";" >> $OUTXecho "" >> $OUTXXnslookup << EOF | awk -f $AWKSCR >> $OUTXset type=NSXrootX.XEOFXXerr=$?Xif test $err -ne 0; thenX	echo "Call to nslookup failed."X	rm -f $OUTXfiXexit $errEND_OF_FILEif test 913 -ne `wc -c <'cachebuild.SH'`; then    echo shar: \"'cachebuild.SH'\" unpacked with wrong size!fichmod +x 'cachebuild.SH'# end of 'cachebuild.SH'fiif test -f 'cachebuild.awk' -a "${1}" != "-c" ; then   echo shar: Will not clobber existing file \"'cachebuild.awk'\"elseecho shar: Extracting \"'cachebuild.awk'\" \(1328 characters\)sed "s/^X//" >'cachebuild.awk' <<'END_OF_FILE'X#X# cachebuild.awkX# Awk script for cachebuild, already designed to parse:X#	nslookup output from pure BIND 4.8.3,X#	nslookup that comes with SunOS 4.1.3.X#XX# Process NS RRs.  These give the names of the root domain servers.XX$2=="nameserver" && $3=="=" {X	roothost[$4] = 1;X}XX# Process A RRs.  These map domain server names to addresses.X# Accumulate these into a space-delimited string; we will break them apart later.X# Note that there may be more than one A RR per root server.XX($2=="inet" || $2=="internet") && $3=="address" && $4=="=" {X	if (roothost[$1] == 1)X		hostaddr[$1] = hostaddr[$1] " " $5;X}XX# Now that we parsed all the records, let's print the rest of the root cache.X# We break the multiple address strings apart with the "split" function.XXEND {X	print ";"X	print "; Initial cache data for root domain servers."X	print ";"X	print ""X	printf (".");X	for (i in roothost) {X		print "			99999999	IN	NS	" i ".";X	}X	print ""X	print ";"X	print "; Prep the cache (hotwire the addresses).  Order does not matter."X	print ";"X	print ""X	for (i in hostaddr) {X		ips = hostaddr[i];X		n = split (ips, hstuff, " ");X		for (j=1; j<=n; j++) {X			printf ("%s.", i);X			l = length (i ".");X			if (l < 8) printf ("	");X			if (l < 16) printf ("	");X			if (l < 24) printf ("	");X			print "99999999	IN	A	" hstuff[j];X		}X	}X}END_OF_FILEif test 1328 -ne `wc -c <'cachebuild.awk'`; then    echo shar: \"'cachebuild.awk'\" unpacked with wrong size!fi# end of 'cachebuild.awk'fiecho shar: End of shell archive.exit 0

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -