View Single Post
  #1   (View Single Post)  
Old 18th November 2008
bigb89 bigb89 is offline
Fdisk Soldier
 
Join Date: May 2008
Posts: 69
Default Update httpd.conf IPs from DNS zones.

Hi guys,

Here's what I'm trying to accomplish:
I have VirtualHost entries on my httpd.conf that looks similar to the following:

Code:
<VirtualHost 301.163.169.211:80>
    ServerName accounttest.com
    ServerAlias www.accounttest.com
    ServerAdmin webmaster@accounttest.com
    DocumentRoot /home/accountt/public_html
    <IfModule mod_suphp.c>
        suPHP_UserGroup accountt accountt
    </IfModule>
    <IfModule !mod_disable_suexec.c>
        User accountt
        Group accountt
    </IfModule>
    BytesLog /usr/local/apache/domlogs/accounttest.com-bytes_log
    CustomLog /usr/local/apache/domlogs/accounttest.com combined
    ScriptAlias /cgi-bin/ /home/accountt/public_html/cgi-bin/
    # To customize this VirtualHost use an include file at the following locatio
n
    # Include "/usr/local/apache/conf/userdata/accountt/accounttest.com/*.conf"
</VirtualHost>
And I have zone files that looks similar to this:
Code:
; cPanel 11.24.0-CURRENT_30944
; Zone file for accounttest.com
$TTL 14400
@      86400    IN      SOA     ns5.domain.com. cpm.domain.com. (
                2008111802      ; serial, todays date+todays
                86400           ; refresh, seconds
                7200            ; retry, seconds
                3600000         ; expire, seconds
                86400 )         ; minimum, seconds

accounttest.com. 86400 IN NS ns5.domain.com.
accounttest.com. 86400 IN NS ns6.domain.com.


accounttest.com. IN A 35.45.68.21

localhost.accounttest.com. IN A 127.0.0.1

accounttest.com. IN MX 0 accounttest.com.

mail IN CNAME accounttest.com.
www IN CNAME accounttest.com.
ftp IN A 35.45.68.21
As you can see, the IP that's on the zone file does not match the IP that's on httpd.conf virtualhost entry. So I would like to do the following:

1) How can I grab the IP from this line: accounttest.com. IN A 35.45.68.21
In the above line, the IP would be 35.45.68.21 (so the $4 variable of the line I guess)

2) Then how can I use the variable $4 from the line above and replace the IP that's being used by the VirtualHost entry of accounttest.com? So the VirtualHost entry would look like this:

<VirtualHost 35.45.68.21>
ServerName accounttest.com
...
...

I'm sorry if this sounds confusing. I kinda have an idea of what needs to be done, but I don't know where to start. Any help will be very appreciated.
Reply With Quote