Bulk dns zone ttl editor
Administering bunch of cPanel servers will eventually require you to move clients from one server to another.
Anyway, probably you have already find yourself in a situation when you have to move a client from one server to another. So to minimize the new IP propagation time one should edit clients DNS zones and put as minimal TTL as one can afford.
After account migration, DNS records propagate much faster then usual and client don’t even notice they have been moved.
When it comes to one account it’s all fair and simple, edit zone, wait for 24h, migrate the account, edit zone back. But what when you have to migrate whole server, let’s say 200+ accounts, 400+ DNS zones, and it’s absolutely vital that they have minimum DNS propagation time.
One would sit all day long editing zones and incrementing SOA serials and reducing zone’s TTL.
So… faced with so much migration these days, I decided to write this script that should help me in that DNS zone editing nightmare.
Script will edit TTL for single or a list of domain names. It changes the zone db file in /var/named/ (if you have your db files placed anywhere else rewrite that). It sets desired TTL, increments the serial, and then invokes cpanel’s perl script which will sync that new edited zone with whole cPanel DNS cluster.
If you have cPanel cluster setup in manner that zone(s) you wish to edit are on DNS clustered server setup as standalone use this script on that server, not on primary and secondary resolver.
Script requires installed http://search.cpan.org/~simonflk/DNS-ZoneParse-0.95/lib/DNS/ZoneParse.pm perl module, so install that first.
Take a peek at the code, there are few variables that may need to be changed. Ideally it should work on standard cPanel installed server
With few modifications (excluding cpanel’s cluster sync command) script will work even for Windows servers.
BEFORE YOU USE THIS SCRIPT, MAKE A BACKUP COPY OF YOUR DATA.
Script has been tested, and used in production environment, but I will not take any responsibility for damage caused by the script via improper handling or possible bugs.
Anyways, latest version of the script can be downloaded at: http://toic.org/files/bttl/bttl.zip
No comments yet.