The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Conf rebuild fix

Discussion in 'General Discussion' started by darklord1, Jun 11, 2008.

  1. darklord1

    darklord1 Well-Known Member

    Jul 8, 2006
    Likes Received:
    Trophy Points:
    cPanel Access Level:
    Root Administrator
    Ohh dear god, I had this problem for 2 days in a row.

    Somehow, one of my clients started adding Addon domains, which created subdomains that the server kept saying didnt exist.

    As ussual, I checked /etc/localdomains /etc/userdomains...... The list goes on.

    But, in the end, I had to run an strace on /scripts/rebuildhttpdconf Just to see where it was failing, because the subdomain was in all the right places.

    This guys sites were down for 3 days, couldnt find anything in cpanel forums, or google, or anything else:

    I kept getting the subdomain does not exist.

    After running the strace:

    strace -fFo output.txt /scripts/rebuildhttpdconf

    Then I grepped output.txt, for the output, and finally saw what was wrong.

    The file /var/cpanel/userdata/cpuser/ didnt exist.

    Well Great, so I touched it, it still failed, but this time, with no ServerName error.

    So I created this template:

    cp_bw_all_limit.conf: 0
    cp_jkmount.conf: 0
    format: "\"%{%s}t %I .\\n%{%s}t %O .\""
    target: /usr/local/apache/domlogs/--Domain---bytes_log
    format: combined
    target: /usr/local/apache/domlogs/--Domain--
    documentroot: /home/--cpuser--/public_html/--DOC--
    group: --cpuser--
    group: --cpuser--
    ip: --ip--
    phpopenbasedirprotect: 1
    port: 80
    path: /home/--cpuser--/public_html/--DOC--/cgi-bin/
    url: /cgi-bin/
    serveradmin: webmaster@--Domain--
    serveralias: www.--Domain--
    servername: --Domain--
    usecanonicalname: 'Off'
    user: --cpuser--
    userdirprotect: ''

    placed it in /var/cpanel/userdata/cpuser/

    named it like temp.txt

    I have a habit of making extensions, to used to windows.

    Anyway, I ran a loop:
    for i in `cat /etc/localdomains|grep`; do cp temp.txt $i; done
    Then I ran the replacement loops:
    for i in `ls|grep`; do t=`/scripts/whoowns $i`;replace '--Domain--' "$i" -- $i; replace '--cpuser--' $t -- $i; doc=`echo $i|cut -d'.' -f1; replace '--DOC--' $doc -- $i; done

    Now, one more replace will need to be run:

    replace '--ip--' '' --$i

    not, but the ip of the domain.

    I am posting this to tell you all, who might have the same issue, This is how I fixed it, after 2 days of research, digging through the code, yeah, I went through the code of cpanel's modules. In the end, I am hoping, if there is an easier way, someone will let me know. I'll feel like an idiot, but you know what, I would REALLY like to feel like an idiot and see a /scripts/rebuilduserdata or something like that.
    or a /scripts/completelyremovesubdomain or something.

    I have every intention of coding a bash script to verify Subdomains are in all the right places, a perl script to rebuild/remove subdomain/addon domain entirely.

Share This Page