View Single Post
  #3   (View Single Post)  
Old 19th November 2008
bigb89 bigb89 is offline
Fdisk Soldier
 
Join Date: May 2008
Posts: 69
Default

Quote:
Actually it would be better to first extract all IN A records into a separate file. After the file has been checked for sanity, then process it.
That sounds like a good idea J65nko.

I'm a not an experienced programmer, so here's my question:

How can I extract the A record lines from the zone files and add them in to a separate file?

This is the line I would like to extract from the zone files:
someDomain.com. IN A someIP

The first delimiter would be the domain name and the fourth would be whatever IP the domain is using. Then based on that, the script would search httpd.conf for: ServerName\ $1. ($1 would be someDomain.com in this case). Once it finds that, it looks for the line above ServerName which is: VirtualHost 0.0.0.0. Then it would replace 0.0.0.0 with $4 which would be someIP from the dns zone file.
Reply With Quote