#!/bin/sh # # watch_whois_record # # AUTHOR: # Dan Harkless # # COPYRIGHT: # This file is Copyright (C) 2003 by Dan Harkless, and is released under the # GNU General Public License . # # USAGE: # % watch_whois_record [] # # EXAMPLE: # % watch_whois_record microsoft.com "expires on 03-May-2012" \ # whois.networksolutions.com # # DESCRIPTION: # There's a domain name that I'm interested in acquiring, and the WHOIS record # shows that it has expired, but trying to register the domain name fails. # # This script, run from cron, will keep checking the WHOIS record to see if # the expiration line changes (either it'll disappear entirely if the # registrar's grace period expires, or it'll change to a future date if they # belatedly renew). # # This script can also be useful if there's a domain to which you have a link # on your site which you aren't sure is permanently defunct or just deliquent # in its renewal. You can have yourself notified as soon as the domain # expiration date (or any other piece of data) changes. # # DATE MODIFICATION # ========== ================================================================== # 2003-04-02 Removed the unnecessary use of a temp file, made the whois server # an optional parameter (now that smart whois clients are common), # and changed the unportable use of "traditional" fgrep's -s # parameter into a redirect to /dev/null. # 2000-09-18 Original. if [ $# -lt 2 -o $# -gt 3 ]; then echo "Usage: watch_whois_record []" exit 1 fi if [ $# = 3 ]; then whois_server="-h $3" fi whois_output=`whois $whois_server $1` if ! echo "$whois_output" | fgrep "$2" > /dev/null; then echo "$whois_output" fi