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.

How do I clean up localdomains?

Discussion in 'General Discussion' started by 4u123, Mar 12, 2009.

  1. 4u123

    4u123 Well-Known Member
    PartnerNOC

    Joined:
    Jan 2, 2006
    Messages:
    765
    Likes Received:
    1
    Trophy Points:
    18
    Hi,

    Is there a way of cleaning up localdomains so it only contains domains that exist on the server?

    I'm trying to add mail domains to a mail appliance via an API and I need localdomains to be correct because I'm using it as the data source. I just did my first run and noticed domains were added that do not exist as primary accounts or parked / addon domains.

    Any advice welcome.
     
  2. 4u123

    4u123 Well-Known Member
    PartnerNOC

    Joined:
    Jan 2, 2006
    Messages:
    765
    Likes Received:
    1
    Trophy Points:
    18
    Ok I worked out that this is only a problem on one server where we have used the "Add a DNS Zone" option in WHM. The domains are not hosted on the server, we just added zone files for them and forgot to untick the "This server will act as the primary MX" box.

    Is there any other domain list on the cpanel server? i.e one that might contain hosted domains only?

    Would be nice to have an up to date list perhaps by using the cpanel user data to compile it rather than checking the parked domains and subdomains lists in WHM manually.

    It seems strange to me that the only way to ge a full list of hosted domains on the server is to download the CSV file for the accounts list then also click "List parked domains" and write them down, then click "List subdomains" and write down the addon domains.

    Any way of getting this info all in one file?
     
  3. Zishan

    Zishan Well-Known Member

    Joined:
    Aug 6, 2005
    Messages:
    104
    Likes Received:
    1
    Trophy Points:
    0
    You can pull out the hosted domains from /var/cpanel/users directory. A simple shell command would give you all domains that are setup on the server and are active:

    /var/cpanel/users is mostly uptodate but not necessarily. Further checks can be added like whether that user still exists on the server or the domain is setup in Apache conf etc.
     
  4. 4u123

    4u123 Well-Known Member
    PartnerNOC

    Joined:
    Jan 2, 2006
    Messages:
    765
    Likes Received:
    1
    Trophy Points:
    18
    Thank you that is very useful.
     
  5. 4u123

    4u123 Well-Known Member
    PartnerNOC

    Joined:
    Jan 2, 2006
    Messages:
    765
    Likes Received:
    1
    Trophy Points:
    18
    Do you know anyone who could write such a script?

    I'd like to compare the info in..

    /var/cpanel/users
    localdomains and remotedomains
    named.conf
    httpd.conf
    and any other files that might be relevent.

    The purpose is to hilight discrepencies and produce an output that shows what domains are listed in those files on the server that should not be there.

    I'm sure on a small scale this doesnt really matter but when you have a large number of servers and "per domain" licensing of some products, it is important to make sure that the data source in use is clean.

    Looking for someone who understands cpanel and can write scripts like this easily. Obviously will pay.
     
Loading...

Share This Page