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.