Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re: How to replace the DNS zone file TTL for 300+ zone files

by Roger (Parson)
on Feb 07, 2004 at 10:37 UTC ( [id://327298]=note: print w/replies, xml ) Need Help??


in reply to How to replace the DNS zone file TTL for 300+ zone files

Learn Perl. Learn to use CPAN. You can roll your own codes, but most likely there's someone else that has done it already.

use strict; use warnings; use IO::File; use DNS::ZoneParse; my @zonefiles = </path/to/zonefile/*>; foreach my $zonefile (@zonefiles) { my $z = DNS::ZoneParse->new($zonefile); # change ttl in all MX records, for example my $mx = $z->mx; $_->{ttl} = 'foo bar' for (@$mx); # update ttl $z->new_serial(); # write the new zone file to disk my $zf = new IO::File "$zonefile", "w" or die "Error writing zonefile: $!"; print $zf $z->output(); }

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://327298]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (2)
As of 2024-04-26 07:20 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found