<?xml version="1.0" encoding="UTF-8"?><rss
version="2.0"
xmlns:content="http://purl.org/rss/1.0/modules/content/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:atom="http://www.w3.org/2005/Atom"
xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
> <channel><title>Comments on: Shell script to check / monitor domain renew / expiration date</title> <atom:link href="http://www.cyberciti.biz/tips/howto-monitor-domain-expiration-renew-date.html/feed" rel="self" type="application/rss+xml" /><link>http://www.cyberciti.biz/tips/howto-monitor-domain-expiration-renew-date.html</link> <description>This is a Linux sys admin journal by Vivek about sys admin work, Linux tips &#38; tricks, hacks, news and more.</description> <lastBuildDate>Fri, 10 Feb 2012 20:37:43 +0000</lastBuildDate> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <generator>http://wordpress.org/?v=3.3.1</generator> <item><title>By: Amir Nasir</title><link>http://www.cyberciti.biz/tips/howto-monitor-domain-expiration-renew-date.html#comment-175422</link> <dc:creator>Amir Nasir</dc:creator> <pubDate>Thu, 03 Nov 2011 11:31:50 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/tips/howto-monitor-domain-expiration-renew-date.html#comment-175422</guid> <description>nice idea bro, thanks for sharing this</description> <content:encoded><![CDATA[<p>nice idea bro, thanks for sharing this</p> ]]></content:encoded> </item> <item><title>By: Ham's</title><link>http://www.cyberciti.biz/tips/howto-monitor-domain-expiration-renew-date.html#comment-160905</link> <dc:creator>Ham's</dc:creator> <pubDate>Wed, 10 Nov 2010 00:42:49 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/tips/howto-monitor-domain-expiration-renew-date.html#comment-160905</guid> <description>For me, this is the simplest script !
Very good, thanks !</description> <content:encoded><![CDATA[<p>For me, this is the simplest script !</p><p>Very good, thanks !</p> ]]></content:encoded> </item> <item><title>By: Joe Peled</title><link>http://www.cyberciti.biz/tips/howto-monitor-domain-expiration-renew-date.html#comment-153166</link> <dc:creator>Joe Peled</dc:creator> <pubDate>Wed, 27 Jan 2010 17:16:45 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/tips/howto-monitor-domain-expiration-renew-date.html#comment-153166</guid> <description>Here&#039;s my twist on that script - this can be ran periodically (daily/weekly/etc) and used to notify of domains expiring - can be called by nagios, etc.
&lt;pre&gt;#!/bin/bash
if [ $# -ne 2 ]; then
echo &quot;usage: $0  &quot;
exit 1
fi
domain=$1
expiration_days=$2
msg=
expiration_string=`whois &quot;$domain&quot; &#124;  egrep -i &#039;Expiration&#124;Expires on&#039; &#124; head -1  &#124; awk &#039;{print $NF}&#039;`
if [ $? -ne 0 ]; then
echo &quot;ERROR executing whois for the $domain domain - $expiration_string&quot;
exit 1
fi
expiration_epoch=`date --date=&quot;$expiration_string&quot; &#039;+%s&#039;`
rightnow_epoch=`date &#039;+%s&#039;`
seconds_left=`expr $expiration_epoch - $rightnow_epoch`
days_left=`expr $seconds_left / 86400`
if [ $days_left -le $expiration_days ]; then
rc=1
msg=&quot;WARNING&quot;
else
rc=0
msg=&quot;OK&quot;
fi
echo &quot;$msg - $domain expires in $days_left days&quot;
exit $rc&lt;/pre&gt;</description> <content:encoded><![CDATA[<p>Here&#8217;s my twist on that script &#8211; this can be ran periodically (daily/weekly/etc) and used to notify of domains expiring &#8211; can be called by nagios, etc.</p><pre>#!/bin/bash
if [ $# -ne 2 ]; then
        echo "usage: $0  "
        exit 1
fi
domain=$1
expiration_days=$2
msg=
expiration_string=`whois "$domain" |  egrep -i 'Expiration|Expires on' | head -1  | awk '{print $NF}'`
if [ $? -ne 0 ]; then
        echo "ERROR executing whois for the $domain domain - $expiration_string"
        exit 1
fi
expiration_epoch=`date --date="$expiration_string" '+%s'`
rightnow_epoch=`date '+%s'`
seconds_left=`expr $expiration_epoch - $rightnow_epoch`
days_left=`expr $seconds_left / 86400`
if [ $days_left -le $expiration_days ]; then
        rc=1
        msg="WARNING"
else
        rc=0
        msg="OK"
fi
echo "$msg - $domain expires in $days_left days"
exit $rc</pre>]]></content:encoded> </item> <item><title>By: Miguel</title><link>http://www.cyberciti.biz/tips/howto-monitor-domain-expiration-renew-date.html#comment-105797</link> <dc:creator>Miguel</dc:creator> <pubDate>Tue, 03 Apr 2007 14:42:40 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/tips/howto-monitor-domain-expiration-renew-date.html#comment-105797</guid> <description>Hi,
really cool idea! It happened to me many times... and I am really stupid that I never thougth about this simple solution....
Thanks :)
Miguel</description> <content:encoded><![CDATA[<p>Hi,<br
/> really cool idea! It happened to me many times&#8230; and I am really stupid that I never thougth about this simple solution&#8230;.<br
/> Thanks :)<br
/> Miguel</p> ]]></content:encoded> </item> </channel> </rss>
