DaemonForums  

Go Back   DaemonForums > Miscellaneous > Programming

Programming C, bash, Python, Perl, PHP, Java, you name it.

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1   (View Single Post)  
Old 18th November 2008
bigb89 bigb89 is offline
Fdisk Soldier
 
Join Date: May 2008
Posts: 69
Thanked 1 Time in 1 Post
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
 

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
httpd problem or something else c0mrade Other BSD and UNIX/UNIX-like 6 15th January 2009 09:19 PM
Apache : httpd could not be started lalebarde General software and network 13 13th November 2008 11:51 PM
difference between rc.conf and loader.conf disappearedng FreeBSD General 5 3rd September 2008 05:54 AM
httpd -DNOHTTPACCEPT starbuck FreeBSD General 9 23rd August 2008 12:14 PM
httpd.conf Snoop1990 General software and network 5 29th July 2008 04:30 AM


All times are GMT. The time now is 09:41 PM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content copyright © 2007-2010, the authors
Daemon image copyright ©1988, Marshall Kirk McKusick