#!/bin/sh # Original par Al Longyear # Mis a jour pour Bind 8 par Nicolai Langfeldt # Plusieurs erreurs découvertes par David A. Ranch # Test avec un ping suggéré par Martin Foster Commentaires TNK tnka@linux-sottises.net # DNS1 adresse IP d'un dns du provider renseignée dans # /etc/hosts # homaster doit exister dans /etc/aliases, lancer newaliases en cas de # modifications de /etc/aliases # Vérifiez si les chemins sont compatibles avec votre propre installation # l'ordre rcnamed restart (sous suse) relance le daemon named, remplacez # cet ordre par ce qui va bien pour votre configuration. # sendmail soit être installé pour prévenir hostmaster de la mise à jour # (ou de l'échec de la mise à jour). Modifiez le fichier si sendmail n'est # pas votre serveur de mail. ( echo "To: hostmaster " echo "From: system " echo "Subject: Automatic update of the root.hint file" echo PATH=/sbin:/usr/sbin:/bin:/usr/bin: export PATH cd /var/named # Are we online? Ping a server at your ISP case `ping -q -n -c1 dns1` in *'100% packet loss'*) echo "The network is DOWN. root.hint NOT updated" echo exit 0 ;; esac dig @e.root-servers.net . ns >root.hint.new 2>&1 case `cat root.hint.new` in *NOERROR*) # It worked :;; *) echo "The root.hint file update has FAILED." echo "This is the dig output reported:" echo cat root.hint.new exit 0 ;; esac echo "The root.hint file has been updated to contain the following information:" 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 "The nameserver has been restarted to ensure that the update is complete." echo "The previous root.hint file is now called /var/named/root.hint.old." ) 2>&1 | /usr/lib/sendmail -t exit 0