diff options
author | Silvio Rhatto <rhatto@riseup.net> | 2011-11-25 14:34:56 -0200 |
---|---|---|
committer | Silvio Rhatto <rhatto@riseup.net> | 2011-11-25 14:34:56 -0200 |
commit | f231fd9b62097dd44a7f08ea618dbc00e11b2f30 (patch) | |
tree | d09fb7f7506604d1342b03bec7e27e81f1fc83bd /files | |
parent | d0bec93f54005df62b99aba205d995a7cbff4bf9 (diff) | |
download | puppet-nodo-f231fd9b62097dd44a7f08ea618dbc00e11b2f30.tar.gz puppet-nodo-f231fd9b62097dd44a7f08ea618dbc00e11b2f30.tar.bz2 |
Added support for .br domains at domain-check
Diffstat (limited to 'files')
-rwxr-xr-x | files/bin/domain-check | 46 |
1 files changed, 37 insertions, 9 deletions
diff --git a/files/bin/domain-check b/files/bin/domain-check index e307b89..869a438 100755 --- a/files/bin/domain-check +++ b/files/bin/domain-check @@ -4,10 +4,13 @@ # # Author: Matty < matty91 at gmail dot com > # -# Current Version: 1.8 +# Current Version: 1.9 # # Revision History: # +# Version 1.9 +# Added support for .br domains -- Silvio Rhatto <rhatto at riseup dot net> +# # Version 1.8 # Bug fix added $MAIL -- Vivek Gite <vivek@nixcraft.com> # @@ -240,6 +243,10 @@ check_domain_status() then ${WHOIS} -h "whois.nic.uk" "${1}" > ${WHOIS_TMP} + elif [ "${TLDTYPE}" == "br" ]; # Brazil + then + ${WHOIS} -h "whois.nic.br" "${1}" > ${WHOIS_TMP} + elif [ "${TLDTYPE}" == "biz" ]; then ${WHOIS} -h "whois.neulevel.biz" "${1}" > ${WHOIS_TMP} @@ -266,6 +273,9 @@ check_domain_status() elif [ "${TLDTYPE}" == "jp" ]; then REGISTRAR=`cat ${WHOIS_TMP} | ${AWK} '/Registrant/ && $2 != "" { REGISTRAR=substr($2,1,17) } END { print REGISTRAR }'` + elif [ "${TLDTYPE}" == "br" ]; + then + REGISTRAR="registro.br" fi # If the Registrar is NULL, then we didn't get any data @@ -287,6 +297,9 @@ check_domain_status() elif [ "${TLDTYPE}" == "uk" ]; # for .uk domain then DOMAINDATE=`cat ${WHOIS_TMP} | awk '/Renewal date:/ { print $3 }'` + elif [ "${TLDTYPE}" == "br" ]; # for .br domain + then + DOMAINDATE=`cat ${WHOIS_TMP} | awk '/expires:/ { print $2 }'` elif [ "${TLDTYPE}" == "jp" ]; # for .jp 2010/04/30 then tdomdate=`cat ${WHOIS_TMP} | awk '/Expires on/ { print $3 }'` @@ -314,16 +327,31 @@ check_domain_status() fi #echo $DOMAINDATE # debug - # Whois data should be in the following format: "13-feb-2006" - IFS="-" - set -- ${DOMAINDATE} - MONTH=$(getmonth ${2}) - IFS="" - - # Convert the date to seconds, and get the diff between NOW and the expiration date - DOMAINJULIAN=$(date2julian ${MONTH} ${1#0} ${3}) + if [ "${TLDTYPE}" == "br" ]; # for .br domain + then + # Convert the date to seconds + DOMAINJULIAN=`date -d ${DOMAINDATE} "+%-m %-d %-Y"` + DOMAINJULIAN=`date2julian ${DOMAINJULIAN}` + else + # Whois data should be in the following format: "13-feb-2006" + IFS="-" + set -- ${DOMAINDATE} + MONTH=$(getmonth ${2}) + IFS="" + + # Convert the date to seconds + DOMAINJULIAN=$(date2julian ${MONTH} ${1#0} ${3}) + fi + + # Get the diff between NOW and the expiration date DOMAINDIFF=$(date_diff ${NOWJULIAN} ${DOMAINJULIAN}) + if [ "${TLDTYPE}" == "br" ]; # for .br domain + then + # Fix domain date for displaying + DOMAINDATE=`date -d ${DOMAINDATE} +"%m-%b-%Y"` + fi + if [ ${DOMAINDIFF} -lt 0 ] then if [ "${ALARM}" = "TRUE" ] |