The Wiert Corner – irregular stream of stuff

Jeroen W. Pluimers on .NET, C#, Delphi, databases, and personal interests

  • My badges

  • Twitter Updates

  • My Flickr Stream

  • Pages

  • All categories

  • Email Subscription

    Enter your email address to subscribe to this blog and receive notifications of new posts by email.

    Join 716 other subscribers

Getting a fresh root hint file on SUSE 12.x

Posted by jpluimers on 2013/07/31

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

[sourcecode language=”shell”]
#! /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
[/sourcecode]

–jeroen

Leave a Comment

 

Discover more from The Wiert Corner - irregular stream of stuff

Subscribe now to keep reading and get access to the full archive.

Continue reading