#!/bin/bash
#
# dns propagation status checker script
#
new=0
old=0
hostname='YOUR.HOSTNAME.COM'
dns_server1='168.95.1.1'
dns_server2='8.8.8.8'
old_ip_address='XXX.XXX.XXX.XXX'
new_ip_address='YYY.YYY.YYY.YYY'
while [ "1" == "1" ]
do
h=`nslookup $hostname $dns_server1 | tail -2 | head -1 | awk '{print $2}'`
s=`nslookup $hostname $dns_server2 | tail -2 | head -1 | awk '{print $2}'`
sleep 1
if [ "$s" == "$new_ip_address" ]
then
new=`echo "$new + 1" | bc`
fi
if [ "$h" == "$new_ip_address" ]
then
new=`echo "$new + 1" | bc`
fi
if [ "$s" == "$old_ip_address" ]
then
old=`echo "$old + 1" | bc`
fi
if [ "$h" == "$old_ip_address" ]
then
old=`echo "$old + 1" | bc`
fi
echo "New: $new Old: $old"
done