Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re: Compare zone files in directory with what is listed in named.conf

by ig (Vicar)
on May 15, 2013 at 20:27 UTC ( #1033738=note: print w/ replies, xml ) Need Help??


in reply to Compare zone files in directory with what is listed in named.conf

Yet another way..

use strict; use warnings; # Putting all of the zonefiles lised in named.conf into an array my $srce = "named.conf.brian"; open(my $FH, $srce) or die "Failed to open file $srce ($!)"; my @files = map { /"([^"]*)/; # get the filename $1 } grep { /^\s*file / } <$FH>; close($FH); # Putting listing of all of the files in ~/zonefiles directory into a +n array # Assigning variable to directory my $directory = "~/zonefiles"; opendir(D, "$directory") || die "Can't opendir $directory: $!\n"; my @list = grep { $_ !~ m/^(\.|\.\.)$/ } readdir(D); closedir(D); # Make hashes of the lists my %configured = map { $_ => 1 } @files; my %existing = map { $_ => 1 } @list; print "Missing zone files:\n"; foreach my $file (@files) { next if($existing{$file}); print "\t$file\n"; } print "Unconfigured zone files:\n"; foreach my $file (@list) { next if($configured{$file}); print "\t$file\n"; }


Comment on Re: Compare zone files in directory with what is listed in named.conf
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (7)
As of 2014-09-02 10:04 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite cookbook is:










    Results (21 votes), past polls