Could always strip anything after the date numbers using regex and also use
a bunch of if/then statements to convert the month names to numbers.
On Jul 21, 2012 4:16 PM, "Simon Vass" <[email protected]> wrote:

> Hi Guys,
>
> I am trying to modify a nagios script which checks whois expiration dates.
> Unfortunately our very own CFI/I3C whois server produces dates in 'Expiry:
>             24th September, 2013' format. I would like a bash date format
> for my script.
>
> expiration=`whois $domain -h registry.co.ug|grep "Expiry:"| awk
> -F"Expiry:" '{print $2}'|cut -f 1`
> cleaned=`echo $expiration | sed 's/\,//g'`
> cleaned2=`echo $cleaned | sed 's/th//g'`
> expseconds=`date +%s --date="$cleaned2"`
> nowseconds=`date +%s`
> ((diffseconds=expseconds-nowseconds))
> expdays=$((diffseconds/86400))
>
>
> I added cleaned with strips the comma from a date, and cleaned2 which
> strips the th from 24th for example, but need a solution that will work for
> any date i.e. 2nd March, 2013 or 1st January, 2014.
>
> Any takers this would make a useful check_whois script so we can poll
> their servers from Nagios.
>
> Obviously CFI/I3C could make this all go away by using ISO dates instead.
> ;-)
>
>
>
>
>
>
>
> Simon Vass
> Managing Director
> E-Tech Uganda Ltd
>
> http://www.etech.ug
> Tel: +256 (0) 312260620 or (0) 312260621
> email: [email protected]
> skype: e-techservicedesk
>
>
> _______________________________________________
> The Uganda Linux User Group: http://linux.or.ug
>
> Send messages to this mailing list by addressing e-mails to:
> [email protected]
> Mailing list archives: http://www.mail-archive.com/[email protected]/
> Mailing list settings: http://kym.net/mailman/listinfo/lug
> To unsubscribe: http://kym.net/mailman/options/lug
>
> The Uganda LUG mailing list is generously hosted by INFOCOM:
> http://www.infocom.co.ug/
>
> The above comments and data are owned by whoever posted them (including
> attachments if any). The mailing list host is not responsible for them in
> any way.
>
_______________________________________________
The Uganda Linux User Group: http://linux.or.ug

Send messages to this mailing list by addressing e-mails to: [email protected]
Mailing list archives: http://www.mail-archive.com/[email protected]/
Mailing list settings: http://kym.net/mailman/listinfo/lug
To unsubscribe: http://kym.net/mailman/options/lug

The Uganda LUG mailing list is generously hosted by INFOCOM: 
http://www.infocom.co.ug/

The above comments and data are owned by whoever posted them (including 
attachments if any). The mailing list host is not responsible for them in any 
way.

Reply via email to