dnswait is a small script to wait for the “propagation” of a namserver configuration.
It’s as easy as:
python -m pip install dnswait
There’s no such thing as DNS propagation
What make your browser don’t hit your server right after you’ve
configured the zone, this long frustrating delay from hours to days,
is the effect of
caches, not “propagation”.
Try it yourself next time you set up a new entry: just don’t hit it
before configuring it, so its absence is not stored in any
caches. Only when configured try it and boom, cache miss all the way
up, no delay, it just works.
There may be some time though between the moment you ask your
registrar to set an entry (via their web user interface or their API)
and the moment it’s really visible on their nameservers, that time I
agree to call “propagation”, and that’s what’s being monitored by this
Say you’ve added a TXT record containing
itsme to proove you’re the
example.com, via the interface of a low-cost hosting
company, and they display a nice message:
Please wait a few minutes for our scripts to propagate the change to
our DNS servers.
Then you can run:
dnswait example.com TXT itsme
the script will wait for all the authoritative servers of example.com
itsme for your text entry, so you know exactly what those
few minutes were, you don’t have to guess.
Say you’re the owner of
mdk.fr (it’s me) and your provider only
allows you to change DNS records using issues on their bug tracker,
then submit the issue asking them to set
18.104.22.168 as the IP for
mdk.fr and run:
dnswait mdk.fr A 22.214.171.124 && notify-send "Hey they configured mdk.fr!"
so you’ll know when it’s done.
(If they reply “it’s done” while
dnswait don’t see it, they probably
Using in shell scripts
If you have a shell script updating DNS configuration via an API, you
dnswait in them to wait for the configuration to be done.
If you want to see what’s happening, run with
$ dnswait mdk.fr A 126.96.36.199 -v INFO:dnswait:3 authoritative name servers to check. INFO:dnswait:All authoritative servers have the expected value.
$ dnswait mdk.fr A 188.8.131.52 -vv INFO:dnswait:3 authoritative name servers to check. DEBUG:dnswait:Checking ns-69-a.gandi.net. DEBUG:dnswait:ns-69-a.gandi.net. have the expected value! DEBUG:dnswait:Checking ns-173-b.gandi.net. DEBUG:dnswait:ns-173-b.gandi.net. have the expected value! DEBUG:dnswait:Checking ns-127-c.gandi.net. DEBUG:dnswait:ns-127-c.gandi.net. have the expected value! INFO:dnswait:All authoritative servers have the expected value.