Wrote a small script that goes into my monthly crontab.
It gets ftp://ftp.internic.net/domain/named.cache into /var/lib/named/named.cache.new, and logs when you need to copy it over into /var/lib/named/root.hint
#! /bin/sh # RootHint=root.hint NamedCache=named.cache NamedCacheDownloadPath=ftp.internic.net/domain/$NamedCache FtpNamedCacheDownloadPath=ftp://$NamedCacheDownloadPath VarLibNamed=/var/lib/named/ VarLibNamedNamedCache=$VarLibNamed$NamedCache VarLibNamedRootHint=$VarLibNamed$RootHint VarLibNamedNamedCacheNew=$VarLibNamed$NamedCache.new #echo "$RootHint" #echo "$NamedCacheDownloadPath" #echo "ftp://ftp.internic.net/domain" #echo "$FtpNamedCacheDownloadPath" #echo "$VarLibNamedNamedCache" #echo "$VarLibNamedNamedCacheNew" cd $VarLibNamed wget -q -N ftp://$NamedCacheDownloadPath if (test -e $VarLibNamedNamedCache) ; then diff $VarLibNamedNamedCache $VarLibNamedNamedCacheNew if [ "$?" -ne "0" ] ; then # if $VarLibNamedNamedCacheNew does not exist, or $VarLibNamedNamedCache is different from $VarLibNamedNamedCacheNew cp -f $VarLibNamedNamedCache $VarLibNamedNamedCacheNew echo "There is a fresh $VarLibNamedNamedCacheNew file that you might want to update into $VarLibNamedRootHint" fi diff $VarLibNamedRootHint $VarLibNamedNamedCacheNew if [ "$?" -ne "0" ] ; then # if $VarLibNamedNamedCacheNew does not exist, or $VarLibNamedRootHint is different from $VarLibNamedNamedCacheNew # rcnamed restart echo "$VarLibNamedRootHint is different from $VarLibNamedNamedCacheNew, you might need to update $VarLibNamedRootHint, then perform rcnamed restart " fi rm -f $VarLibNamedNamedCache fi
–jeroen
Filed under: *nix, Development, Linux, Power User, Scripting, Sh Shell, Software Development, SuSE Linux, wget
