scripts/domain-check: handle .cz domains, sleep 30secs in loop
authorTomas Zeman <tzeman@volny.cz>
Tue, 16 Oct 2012 15:19:02 +0200
changeset 20 fe1c8b4725f7
parent 19 08238959d9fc
child 21 14a903cf9505
scripts/domain-check: handle .cz domains, sleep 30secs in loop
scripts/domain-check
--- a/scripts/domain-check	Fri Sep 07 11:14:29 2012 +0200
+++ b/scripts/domain-check	Tue Oct 16 15:19:02 2012 +0200
@@ -269,6 +269,9 @@
     elif [ "${TLDTYPE}" == "jp" ];
     then
         REGISTRAR=`cat ${WHOIS_TMP} | ${AWK} '/Registrant/ && $2 != ""  { REGISTRAR=substr($2,1,17) } END { print REGISTRAR }'`
+    elif [ "${TLDTYPE}" == "cz" ];
+    then
+        REGISTRAR=`cat ${WHOIS_TMP} | ${AWK} '/registrar:/ && $2 != ""  { REGISTRAR=substr($2,1,17) } END { print REGISTRAR }'`
     fi
 
     # If the Registrar is NULL, then we didn't get any data
@@ -312,6 +315,28 @@
 		esac
             tday=`echo ${tdomdate} | cut -d'/' -f3`
 	    DOMAINDATE=`echo $tday-$tmonth-$tyear`
+    elif [ "${TLDTYPE}" == "cz" ]; # for .cz 08.02.2013 dd.mm.yyyy
+    then
+	    tdomdate=`cat ${WHOIS_TMP} | awk '/expire:/ { print $2 }'`
+        tyear=`echo ${tdomdate} | cut -d'.' -f3`
+        tmon=`echo ${tdomdate} | cut -d'.' -f2`
+        tday=`echo ${tdomdate} | cut -d'.' -f1`
+        case ${tmon} in
+             1|01) tmonth=jan ;;
+             2|02) tmonth=feb ;;
+             3|03) tmonth=mar ;;
+             4|04) tmonth=apr ;;
+             5|05) tmonth=may ;;
+             6|06) tmonth=jun ;;
+             7|07) tmonth=jul ;;
+             8|08) tmonth=aug ;;
+             9|09) tmonth=sep ;;
+             10)   tmonth=oct ;;
+             11)   tmonth=nov ;;
+             12)   tmonth=dec ;;
+              *)   tmonth=0 ;;
+        esac
+	    DOMAINDATE=`echo $tday-$tmonth-$tyear`
     else # .com, .edu, .net and may work with others	 
 	    DOMAINDATE=`cat ${WHOIS_TMP} | ${AWK} '/Expiration/ { print $NF }'`	
     fi
@@ -457,6 +482,7 @@
         print_heading
         while read DOMAIN
         do
+                sleep 30
                 check_domain_status "${DOMAIN}"
 
         done < ${SERVERFILE}
@@ -476,3 +502,4 @@
 ### Exit with a success indicator
 exit 0
 
+# vim: et ts=4 sw=4