Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
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 ( [id://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"; }

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others perusing the Monastery: (4)
As of 2024-03-29 07:57 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found