Written by James McDonald

May 6, 2009

If you have delegated your DNS to another hosting provider you may want to send yourself an email when your DNS domain delegation has propogated (so you can notify people after the change and not have everyone saying “I can’t get to your site”).

Create a script as follows and then install crontab to run it every X minutes.

The email you receive will have a time stamp to the nearest X minutes.

Create checkit.sh in your home directory
Replace jamesmcdonald.id.au with your domain and with one of your ISP’s DNS server IP addresses. And obviously edit [email protected] to be your own email address.

# edit this to be a substring of the new dns servers you are moving to.
# ie. my new DNS servers are 
# ns1.dreamhost.com 
# ns2.dreamhost.com 
# ns2.dreamhost.com 
# so setting it to dreamhost.com will match when the 
# dig query returns the newly propogated server list

# CHECKTHIS=dyndns
# CHECKTHIS= (you can check for an IP aswell)
dig -t ns jamesmcdonald.id.au @ | \
&& if [ ! -f sent ] ; \
then touch sent ; \
echo Sending ; \
echo DNS has propagated | \
mail -s "DNS Updated" [email protected] ; \

Crontab to run above script every 5 minutes

# m h  dom mon dow   command
*/5 * * * * $HOME/checkit.sh

You obviously need the mail command installed on your box apt-get install mailx and dig aswell apt-get install dnsutils (this is for Ubuntu/Debian)


  1. cwraig

    Nice, i’m going to be moving hosts next weekend for some sites and I will use this for sure.

  2. cello

    I’m not sure how you worked this out, but it’ll sure come in handy!


Submit a Comment

Your email address will not be published. Required fields are marked *

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

The reCAPTCHA verification period has expired. Please reload the page.

You May Also Like…

Meraki Open Source Licenses

Until today I assumed that Meraki was built in-house with only closed source software. But having a look at the...


If you have Veeam backup failing with the Updating BCD failed with Cannot update SafeBoot flag and SentinelOne is...