/ Published in: Bash
Simple whois monitor for running via crontab and monitoring changes of single (per cron task) domain changes. Compare sizes to exclude unimportant updates
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
#!/bin/sh # Copyright (c) 2006 Mihail Fedorov, http://mihailfedorov.ru # $ ./whois.sh domain.tld whois.server.tld [email protected] # change this WORKDIR="/home/kolo/whoistory" # thanks NEWFILE="$WORKDIR/$1.$2" OLDFILE="$WORKDIR/$1.$2.old" mv $NEWFILE $OLDFILE 2> /dev/null whois -h $2 $1 > $NEWFILE 2> /dev/null oldsize=$(ls -l "$OLDFILE" 2> /dev/null | awk '{print $5}') newsize=$(ls -l "$NEWFILE" | awk '{print $5}') if [ "$oldsize" != "$newsize" ]; then cat $NEWFILE | mail -s "[Whoistory] $1 updated!" $3 fi