Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
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 all is quiet...

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (3)
As of 2016-12-11 14:59 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    On a regular basis, I'm most likely to spy upon:













    Results (169 votes). Check out past polls.