Domain Expiration Check Shell Script

From www.cyberciti.biz

I’ve already written about a shell script to check / monitor domain renew / expiration date here. Now I’ve modified matt’s domain-check script to support additional C/TLDs .in, .biz, .org and .info domains. I’ve also added 5 seconds delay to avoid whois server rejecting query. This script checks to see if a domain has expired. It can be run in interactive and batch mode, and provides facilities to alarm if a domain is about to expire in advance.
Sample usage

Display expiration date and registrar for theos.in domain:

domain-check-2 -d {domain-name}


$ domain-check-2 -d theos.in
Output:

Domain Registrar Status Expires Days Left
----------------------------------- ----------------- -------- ----------- ---------
theos.in et4India (R7-AFIN Valid 28-Oct-2009 799

You can also get an email if theos.in going to expire in 30 days

domain-check-2 -a -d theos.in -q -x 30 -e vivek@nixcraft.com

However most killer feature is you can read list of domain names from a file such as mydomains.txt (list each domain on a new line):

$ domain-check-2 -a -f mydomains.txt -q -x 30 -e vivek@nixcraft.com
OR
$ domain-check-2 -f mydomains.txt

Output:

Domain Registrar Status Expires Days Left
----------------------------------- ----------------- -------- ----------- ---------
theos.in et4India (R7-AFIN Valid 28-Oct-2009 799
nixcraft.org GoDaddy.com, Inc. Valid 13-Aug-2009 723
vivekgite.com MONIKER ONLINE SE Valid 18-aug-2010 1093
cyberciti.biz Valid 30-Jun-2009 679
nixcraft.info oDaddy.com Inc. ( Valid 26-Jun-2009 675
nixcraft.net GODADDY.COM, INC. Valid 11-dec-2009 843

Download

=> Download modified domain-check-2 script here.
Quick installation

Use wget command to download and install domain-check script:
$ wget http://www.cyberciti.biz/files/scripts/domain-check-2.txt
$ mv domain-check-2.txt domain-check
$ chmod +x domain-check
$ ./domain-check -d vivekgite.com

Make sure you run the domain-check script using a cron job.

g33kadmin

I am a g33k, Linux blogger, developer, student and Tech Writer for Liquidweb.com/kb. My passion for all things tech drives my hunt for all the coolz. I often need a vacation after I get back from vacation....

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.