packages: nagios-plugin-check_domain/check_domain - respect whoispath

glen glen at pld-linux.org
Tue Dec 7 11:43:16 CET 2010


Author: glen                         Date: Tue Dec  7 10:43:16 2010 GMT
Module: packages                      Tag: HEAD
---- Log message:
- respect whoispath

---- Files affected:
packages/nagios-plugin-check_domain:
   check_domain (1.7 -> 1.8) 

---- Diffs:

================================================================
Index: packages/nagios-plugin-check_domain/check_domain
diff -u packages/nagios-plugin-check_domain/check_domain:1.7 packages/nagios-plugin-check_domain/check_domain:1.8
--- packages/nagios-plugin-check_domain/check_domain:1.7	Tue Dec  7 11:40:51 2010
+++ packages/nagios-plugin-check_domain/check_domain	Tue Dec  7 11:43:11 2010
@@ -70,20 +70,24 @@
 # Looking for whois binary
 if [ -z $whoispath ]; then
 	type whois > /dev/null 2>&1 || die $STATE_UNKNOWN "UNKNOWN - Unable to find whois binary in your path. Is it installed? Please specify path."
+	whois=whois
 else
 	[ -x "$whoispath/whois" ] || die $STATE_UNKNOWN "UNKNOWN - Unable to find whois binary, you specified an incorrect path"
+	whois="$whoispath/whois"
 fi
 
+out=$($whois $domain)
+
 # Calculate days until expiration
 case "$domain" in
 *.ru)
-	expiration=$(whois $domain | awk '/paid-till:/{split($2, a, "."); printf("%s-%s-%s\n", a[1], a[2], a[3])}')
+	expiration=$(echo "$out" | awk '/paid-till:/{split($2, a, "."); printf("%s-%s-%s\n", a[1], a[2], a[3])}')
 	;;
 *.ee)
-	expiration=$(whois $domain | awk '/expire:/{split($2, a, "."); printf("%s-%s-%s\n", a[3], a[2], a[1])}')
+	expiration=$(echo "$out" | awk '/expire:/{split($2, a, "."); printf("%s-%s-%s\n", a[3], a[2], a[1])}')
 	;;
 *)
-	expiration=$(whois $domain |awk -F: '/Expiration Date:/{print substr($0, length($1) + 2)}')
+	expiration=$(echo "$out" | awk -F: '/Expiration Date:/{print substr($0, length($1) + 2)}')
 	;;
 esac
 
================================================================

---- CVS-web:
    http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/packages/nagios-plugin-check_domain/check_domain?r1=1.7&r2=1.8&f=u



More information about the pld-cvs-commit mailing list