#!/bin/sh # # Dieses Skript aktualisiert einmal im Monat die Nameserver-Cache-Datei. # Es wird durch einen Cron-Eintrag gestartet. # # Original von Al Longyear # An bind8 angepasst von Nicolai Langfeldt # Verschiedene Problem-Reports durch David A. Ranch # Ping-Test vorgeschlagen von Martin Foster # ersetzung von Thomas "Balu" Walter # # an bind 9.x angepasst von hans - Cyberspace Ashram - www.kriyayoga.com # ( echo "To: hostmaster " echo "From: system " echo "Subject: Automated Update of file root.hint" echo PATH=/sbin:/usr/sbin:/bin:/usr/bin: export PATH cd /var/lib/named # are we online ? ping a domain - best your own domain !! case `ping -qnc mydomain.com` in *'100% packet loss'*) echo "We are offline. root.hint NOT updated" echo exit 0 ;; esac dig @e.root-servers.net . ns > /var/lib/named/root.hint.new case `cat root.hint.new` in *NOERROR*) # it works ... :;; *) echo "Update file root.hintFAILED." echo "dig output:" echo cat root.hint.new exit 0 ;; esac echo "File root.hint successfully updated with follwoing data:" echo cat root.hint.new chown root.root root.hint.new chmod 444 root.hint.new rm -f root.hint.old mv root.hint root.hint.old mv root.hint.new root.hint rcnamed restart echo echo "DNS restarted to finalize the update." echo "The original file root.hint is now renamed /var/lib/named/root.hint.old." ) 2>&1 | /usr/lib/sendmail -t exit 0