how to list ALL zones of my master server
Saad Kadhi
bsdguy at docisland.org
Thu Sep 26 12:58:53 UTC 2002
On Thu, Sep 26, 2002 at 10:29:42AM +0200, Iñaki Martínez wrote:
>
> Hi!!
>
> I have a master and slave servers, in the master several administrator
> add/remove new/old domains (zones), so i, the main administrator, must
> to check (with a diff) what domains have been added/removed and then
> make changes to the slave server.
>
> So i wonder if there is a "magic" solution to do this automatic......
I cannot think of such magic in the standard BIND distribution. But you can do
it yourself pretty easily. To get you started, here is one way to do it:
--
#!/usr/bin/perl
use warnings;
use strict;
die "no args given!" unless @ARGV;
my $file = shift @ARGV;
open FD, "< $file";
my @lines = <FD>;
close FD;
my ($number_of_zones, $number_of_master_zones, @zone_list) = (0, 0, );
for (my $i=0; $i<scalar(@lines); $i++) {
if ($lines[$i] =~ /zone\s+"([-a-zA-Z0-9.]+)"\s*{/) {
$zone_list[$number_of_zones] = $1;
$number_of_zones++;
$number_of_master_zones++ if ($lines[$i+1] =~ /type\s+master;/)
}
}
print "server has a total $number_of_zones zones and he is primary master for
$number_of_master_zones.\n";
--
Cheers.
--
Saad Kadhi -- [saad at docisland.org] [bsdguy at docisland.org]
[pgp keyid: 35592A6D http://pgp.mit.edu]
[pgp fingerprint: BF7D D73E 1FCF 4B4F AF63 65EB 34F1 DBBF 3559 2A6D]
---
"Si ce que tu dis n'est ni beau, ni bon, ni vrai, alors tais-toi!"
- Socrate
More information about the bind-users
mailing list