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
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:

<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 !mod_disable_suexec.c>
        User accountt
        Group accountt
    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
    # Include "/usr/local/apache/conf/userdata/accountt/accounttest.com/*.conf"
And I have zone files that looks similar to this:
; 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

localhost.accounttest.com. IN A

accounttest.com. IN MX 0 accounttest.com.

mail IN CNAME accounttest.com.
www IN CNAME accounttest.com.
ftp IN A
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
In the above line, the IP would be (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:

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 04:44 PM.

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