Benjamin Renard commited on 2012-11-15 14:02:53
Showing 1 changed files, with 23 additions and 3 deletions.
... | ... |
@@ -53,6 +53,26 @@ case $TLD in |
53 | 53 |
echo "UNKNOWN : Dot ES TLD has no whois server. Check domain $DOMAIN is not possible." |
54 | 54 |
exit 3 |
55 | 55 |
;; |
56 |
+ eu) |
|
57 |
+ if [ ! -n "$2" ] |
|
58 |
+ then |
|
59 |
+ echo "UNKNOWN : Dot EU TLD not provide expire date in WHOIS result. You can provide manually expiration date in second parameter." |
|
60 |
+ exit 3 |
|
61 |
+ fi |
|
62 |
+ |
|
63 |
+ if [ $( echo -e "$WHOIS"|grep -c "AVAILABLE" ) -gt 0 ] |
|
64 |
+ then |
|
65 |
+ echo "CRITICAL - Domain $DOMAIN not registred !" |
|
66 |
+ exit 2 |
|
67 |
+ fi |
|
68 |
+ |
|
69 |
+ EXDATE=$2 |
|
70 |
+ EXTIME=$( date +%s --date=$2 ) |
|
71 |
+ if [ $? -ne 0 ] |
|
72 |
+ then |
|
73 |
+ echo "UNKNOWN : Expire date provide not recognized. Ex : YYYYMMDD" |
|
74 |
+ fi |
|
75 |
+ ;; |
|
56 | 76 |
*) |
57 | 77 |
EXTXT=`echo -e "$WHOIS"|grep "^expires:"` |
58 | 78 |
[ $DEBUG -eq 1 ] && echo "expire result format 1 : $EXTXT" |
... | ... |
@@ -77,9 +97,9 @@ let DIFF=EXTIME-CURTIME |
77 | 97 |
let nb=DIFF/86400 |
78 | 98 |
[ $DEBUG -eq 1 ] && echo "Nb day(s) : $nb" |
79 | 99 |
|
80 |
-if [ $nb -le $CRIT ] |
|
100 |
+if [ "$nb" -le $CRIT ] |
|
81 | 101 |
then |
82 |
- if [ $nb -lt 0 ] |
|
102 |
+ if [ "$nb" -lt 0 ] |
|
83 | 103 |
then |
84 | 104 |
let nb=nb*-1 |
85 | 105 |
echo "CRITICAL : $DOMAIN is expired since $nb day(s) !" |
... | ... |
@@ -87,7 +107,7 @@ then |
87 | 107 |
echo "CRITICAL : $DOMAIN expire in $nb day(s) !" |
88 | 108 |
fi |
89 | 109 |
exit 2 |
90 |
-elif [ $nb -le $WARN ] |
|
110 |
+elif [ "$nb" -le $WARN ] |
|
91 | 111 |
then |
92 | 112 |
echo "WARNING : $DOMAIN expire in $nb day(s) !" |
93 | 113 |
exit 1 |
94 | 114 |