Permalink
Browse files

Better control of the result of dig, to avoid the "delete all TLDs" bug

git-svn-id: https://svn.generic-nic.net/NIC-generique/iana/whois@10763 e62f009e-d044-43ae-9900-873abb462db7
  • Loading branch information...
1 parent e42f3ad commit d9075676653ead9d14b95af648ee18014c5ef9f3 @bortzmeyer bortzmeyer committed May 11, 2011
Showing with 11 additions and 1 deletion.
  1. +11 −1 get-whois-and-commit
View
@@ -20,9 +20,19 @@ if [ ! -e $LIST ]; then
sendemail.py -t $MAINTAINER -f $MAINTAINER -s "Cannot find $LIST" < /dev/null
fi
-dig @${ROOTNAMESERVER}.root-servers.net AXFR . | awk -F. '/^[A-Za-z][A-Za-z0-9-]+\.\t.*NS/ {print toupper($1)}' | sort | uniq > $TLDFILE
+(dig @${ROOTNAMESERVER}.root-servers.net AXFR . | awk -F. '/^[A-Za-z][A-Za-z0-9-]+\.\t.*NS/ {print toupper($1)}' | sort | uniq > $TLDFILE) 2> $LOG
+# dig does not set a proper return code
+
+if [ ! -z "$(cat $LOG)" ]; then
+ sendemail.py -t $MAINTAINER -f $MAINTAINER -s "Cannot retrieve the list of TLDs" < $LOG
+ exit 1
+fi
TLDS=$(cat $TLDFILE)
+if [ -z "$TLDS" ]; then
+ sendemail.py -t $MAINTAINER -f $MAINTAINER -s "List of TLDs is empty" < $LOG
+ exit 1
+fi
svn update -q

0 comments on commit d907567

Please sign in to comment.