From 476e411f5f6149636668fa134db1437f7ffa3b39 Mon Sep 17 00:00:00 2001 From: Silvio Rhatto Date: Mon, 10 Sep 2012 11:38:35 -0300 Subject: Fixing output for .br domains when expiry date is not available on domain-check --- files/bin/domain-check | 30 ++++++++++++++++++++++++------ 1 file changed, 24 insertions(+), 6 deletions(-) diff --git a/files/bin/domain-check b/files/bin/domain-check index 90d522f..ebefb6b 100755 --- a/files/bin/domain-check +++ b/files/bin/domain-check @@ -8,6 +8,10 @@ # # Revision History: # +# Version 1.11 +# Fixing mail program path -- Silvio Rhatto +# Fixing output for .br domains when expiry date is not available -- Silvio Rhatto +# # Version 1.10 # Do not add extra line on quiet mode -- Silvio Rhatto # @@ -332,9 +336,14 @@ check_domain_status() #echo $DOMAINDATE # debug if [ "${TLDTYPE}" == "br" ]; # for .br domain then - # Convert the date to seconds - DOMAINJULIAN=`$DATE -d ${DOMAINDATE} "+%-m %-d %-Y"` - DOMAINJULIAN=`date2julian ${DOMAINJULIAN}` + # If registro.br outputs in reduced mode when query limits are + # reached, the whois server does not output expiry information. + if [ ! -z "${DOMAINDATE}" ]; + then + # Convert the date to seconds + DOMAINJULIAN=`$DATE -d ${DOMAINDATE} "+%-m %-d %-Y"` + DOMAINJULIAN=`date2julian ${DOMAINJULIAN}` + fi else # Whois data should be in the following format: "13-feb-2006" IFS="-" @@ -347,15 +356,24 @@ check_domain_status() fi # Get the diff between NOW and the expiration date - DOMAINDIFF=$(date_diff ${NOWJULIAN} ${DOMAINJULIAN}) + if [ ! -z "${DOMAINJULIAN}" ]; + then + DOMAINDIFF=$(date_diff ${NOWJULIAN} ${DOMAINJULIAN}) + else + # We have no information + DOMAINDIFF="undef" + fi - if [ "${TLDTYPE}" == "br" ]; # for .br domain + if [ "${TLDTYPE}" == "br" ] && [ ! -z "${DOMAINDATE}" ]; # for .br domain then # Fix domain date for displaying DOMAINDATE=`$DATE -d ${DOMAINDATE} +"%m-%b-%Y"` fi - if [ ${DOMAINDIFF} -lt 0 ] + if [ ${DOMAINDIFF} == 'undef' ]; + then + prints ${DOMAIN} "No info" "$?" "?" ${REGISTRAR} + elif [ ${DOMAINDIFF} -lt 0 ] then if [ "${ALARM}" = "TRUE" ] then -- cgit v1.2.3