User Tools

Site Tools




Check DNS propagation (useful during domain transfer)

When a domain is pending transfer it may be useful to be notified as soon as possibile when the DNS propagates to our location, so we can reach the new server immediately. This problem is particularly important with some hosting services because you don't have access ahead of that time.

There are some services online to control the DNS propagation, but no one serve the scope better than a script on our computer because no other place is closest than that! ^_^

Usually I used to run a simple ping (Debian/Ubuntu/Mint don't have DNS cache), but often I forgot to check regularly ending up with the new domain being accessibile for hours.

How to automate this process? On a Windows system we should use a programming language, but on a Linux system bash alone gives us great power! (and great responsibilities) ^_^

#DNSCHANGE - v 1.0.0  (19/10/2012)
#LGPL licence
#This script notifies when a given domain changes IP.
#Useful when transferring domains.
#Syntax: dnschange <domain> <current ip>
echo "Hit CTRL+C to stop checking IP";
while [ $stop -lt 1 ]
	pingRes=$(ping -c1 $1);
	#echo $pingRes;
	if [[ "$pingRes" != *$2* ]]
		xmessage -nearmouse "__________IP HAS CHANGED_____________";
		sleep 60;

It checks every minute for a change and, if the domain/ip relation change, a message pops up near the mouse pointer.

For the notification I used xmessage instead of zenity because it's installed by default in the ubuntu/debian/mint distros.

linux/bash/check-dns-propagation.txt · Last modified: 2014/09/12 15:10 by rik