Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

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

by Kenosis (Priest)
on May 15, 2013 at 22:17 UTC ( #1033743=note: print w/ replies, xml ) Need Help??


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

The following first captures the file names in named.conf and places them into a hash. It then globs the zonefiles' directory, and attempts to find each listed file from that directory in the hash. If the file name's not in the hash, it's pushed onto @unlistedFiles for later processing:

use strict; use warnings; my ( %named_conf, @unlistedFiles ); open my $fh, '<', 'named.conf' or die $!; /\s+file\s+"([^"]+)/ and $named_conf{$1}++ for <$fh>; close $fh; chdir 'zonefiles' or die $!; !defined $named_conf{$_} and push @unlistedFiles, $_ for <db.*>; print "$_\n" for @unlistedFiles;

Files in zonefiles directory:

db.127.0.0 db.brian.com db.cache db.test.com db.what db.why

Output using your named.conf:

db.what db.why

Hope this helps!


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

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (9)
As of 2014-07-11 06:41 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    When choosing user names for websites, I prefer to use:








    Results (220 votes), past polls