Whois monitor (single domain)


/ Published in: Bash
Save to your folder(s)

Simple whois monitor for running via crontab and monitoring changes of single (per cron task) domain changes. Compare sizes to exclude unimportant updates


Copy this code and paste it in your HTML
  1. #!/bin/sh
  2. # Copyright (c) 2006 Mihail Fedorov, http://mihailfedorov.ru
  3. # $ ./whois.sh domain.tld whois.server.tld [email protected]
  4.  
  5. # change this
  6. WORKDIR="/home/kolo/whoistory"
  7. # thanks
  8.  
  9. NEWFILE="$WORKDIR/$1.$2"
  10. OLDFILE="$WORKDIR/$1.$2.old"
  11.  
  12. mv $NEWFILE $OLDFILE 2> /dev/null
  13. whois -h $2 $1 > $NEWFILE 2> /dev/null
  14.  
  15. oldsize=$(ls -l "$OLDFILE" 2> /dev/null | awk '{print $5}')
  16. newsize=$(ls -l "$NEWFILE" | awk '{print $5}')
  17.  
  18. if [ "$oldsize" != "$newsize" ]; then
  19. cat $NEWFILE | mail -s "[Whoistory] $1 updated!" $3
  20. fi

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.