Update : Enabled "strict" and fixed code typos.#!/usr/bin/perl # Putting all of the zonefiles lised in named.conf into an array use strict; use warnings; my $srce = "named.conf.brian"; my %zonefilenames; open(my $FH, "<", $srce) or die "Failed to open file $srce ($!)"; while (<$FH>){ next unless my ($filename) = m/file\s*"([^"]+)/; next if $filename eq "db.cache"; $zonefilenames{ $filename } =""; } close($FH); print "Zone Files: ",join( ", ", keys %zonefilenames)," \n"; # Putting listing of all of the files in ~/zonefiles directory into a +n array # Assigning variable to directory my $directory = "~/zonefiles/"; opendir(my $D, "$directory") or die "Can't opendir $directory: $!\n"; while ( readdir($D)){ next if m/^\./; # Ignore things with leading dots chomp; my $found = exists $zonefilenames{ $_ } ? "" : "Not found in zone +definition"; print "$_ : $found\n"; } closedir($D);
"I'm fairly sure if they took porn off the Internet, there'd only be one website left, and it'd be called 'Bring Back the Porn!'"
-- Dr. Cox, Scrubs
In reply to Re: Compare zone files in directory with what is listed in named.conf
by NetWallah
in thread Compare zone files in directory with what is listed in named.conf
by brianjb
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |