So you’re migrating servers and you want to make sure that the TTL’s on your DNS zones are low so that DNS propagates quickly. Instead of changing all the TTL’s manually in Edit a DNS Zone in WHM, you can run a very simple script from SSH to change all TTLs from 14400 to 300 seconds.
First we’ll create a backup, then we’ll make the mass change:
1) mkdir /root/var.named.backup/
2) cp -Rv /var/named/* /root/var.named.backup/
3) cd /var/named
4) replace -v “$TTL 14400″ “$TTL 3600″ — *.db
5) /usr/sbin/rndc reload
If you have DNS zones using a TTL other than 14400 seconds, rerun the script again, replacing 14400 with that value.
Next you’ll likely want to increase the serial number for your DNS zones, so that BIND recognizes the changes.