Finding out when your DNS delegation has propogated

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 220.233.0.4 with one of your ISP’s DNS server IP addresses. And obviously edit [email protected] to be your own email address.

#!/bin/sh
# 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=dreamhost.com 
# CHECKTHIS=dyndns
# CHECKTHIS=203.147.175.1 (you can check for an IP aswell)
dig -t ns jamesmcdonald.id.au @220.233.0.4 | \
grep $CHECKTHIS \
&& if [ ! -f sent ] ; \
then touch sent ; \
echo Sending ; \
echo DNS has propagated | \
mail -s "DNS Updated" [email protected] ; \
fi

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)

2 Comments

  1. cwraig

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

    Reply
  2. cello

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

    Reply

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…

Squarespace Image Export

To gain continued access to your Squarespace website images after cancelling your subscription you have several...

MySQL 8.x GRANT ALL STATEMENT

-- CREATE CREATE USER 'tgnrestoreuser'@'localhost' IDENTIFIED BY 'AppleSauceLoveBird2024'; GRANT ALL PRIVILEGES ON...

Exetel Opt-Out of CGNAT

If your port forwards and inbound and/or outbound site-to-site VPN's have failed when switching to Exetel due to their...