|laziness, impatience, and hubris|
Compare zone files in directory with what is listed in named.confby brianjb (Novice)
|on May 15, 2013 at 19:11 UTC||Need Help??|
brianjb has asked for the
wisdom of the Perl Monks concerning the following question:
I would really appreciate any assistance that I can get here. I am fairly new to perl. I am trying to rewrite my shell scripts to perl. Currently I have a shell script (using sed, awk, grep, etc) that gets a list of all of the zone files in a directory and then looks in named.conf for what is expected to be in there. If there is a file in the directory that isn't listed in named.conf, then it emails and lets me know that there is some stale files for me to look at. In the past, I have used Text::Diff module to do a diff. Is there any way to put these into two arrays and do a diff without that module? Looking for feedback on either using a module, or doing it without a module. There is more than one way, right?
This is sample named.conf:
This is listing of zonefiles in directory:
This is the script so far:
This is the output when I run it:
How would I ignore things that I don't want to check? For example, ignore db.cache in named.conf. I also want to ignore "." and ".." in the zone file directory.