]> gitweb.fluxo.info Git - puppet-domain_check.git/commitdiff
Another lookup fix for .org domains
authorSilvio Rhatto <rhatto@riseup.net>
Mon, 17 Feb 2014 16:16:53 +0000 (13:16 -0300)
committerSilvio Rhatto <rhatto@riseup.net>
Mon, 17 Feb 2014 16:16:53 +0000 (13:16 -0300)
files/domain-check

index b2df60b108fa071923239132207e32cf463cfc0c..2342bc2cb52dc363685fbe01a642e70b88b1bf88 100755 (executable)
@@ -8,6 +8,9 @@
 #
 # Revision History:
 #
+#  Version 1.13
+#    Another lookup fix for .org domains.
+#
 #  Version 1.12
 #    Fix lookup for .org domains.
 #
@@ -308,7 +311,7 @@ check_domain_status()
     # for .in, .info, .org domains
     if [ "${TLDTYPE}" == "org" ];
     then
-           DOMAINDATE=`cat ${WHOIS_TMP} | ${AWK} '/Registry Expiry Date:/ { print $4 }' | cut -d':' -f2`
+           DOMAINDATE=`cat ${WHOIS_TMP} | ${AWK} '/Registry Expiry Date:/ { print $4 }' | cut -d':' -f1 | sed -e 's/T.*$//'`
     elif [ "${TLDTYPE}" == "in" -o "${TLDTYPE}" == "info" ];
     then
            DOMAINDATE=`cat ${WHOIS_TMP} | ${AWK} '/Expiration Date:/ { print $2 }' | cut -d':' -f2`
@@ -361,6 +364,15 @@ check_domain_status()
               DOMAINJULIAN=`$DATE -d ${DOMAINDATE} "+%-m %-d %-Y"`
               DOMAINJULIAN=`date2julian ${DOMAINJULIAN}`
             fi
+    elif [ "${TLDTYPE}" == "org" ]; # for .org domain
+    then
+            # Whois data should be in the following format: "2006-02-13"
+            YEAR=$(echo $DOMAINDATE  | cut -d '-' -f 1)
+            MONTH=$(echo $DOMAINDATE | cut -d '-' -f 2)
+            DAY=$(echo $DOMAINDATE   | cut -d '-' -f 3)
+
+            # Convert the date to seconds
+            DOMAINJULIAN=$(date2julian ${MONTH} ${DAY} ${YEAR})
     else
             # Whois data should be in the following format: "13-feb-2006"
             IFS="-"