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.

where are addon domain

Discussion in 'General Discussion' started by mohd_007, Mar 28, 2012.

  1. mohd_007

    mohd_007 Well-Known Member

    Joined:
    Sep 22, 2007
    Messages:
    57
    Likes Received:
    0
    Trophy Points:
    6
    cPanel Access Level:
    Website Owner
    where are addon domain entries located? Actully i am writing a program where is necessary to give out put of how many addon domains are located in a user.
     
  2. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,854
    Likes Received:
    676
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
    Hello :)

    You can find addon domain information in several locations. This includes:

    Code:
    /var/cpanel/users/$username
    /var/cpanel/userdata/$username/
    /etc/userdatadomains
    If you are seeking to extract which domain names are addon domain names, then the "/etc/userdatadomains" file may be the best option. EX:

    Code:
    # grep addon /etc/userdatadomains
    Thank you.
     
  3. cPanelTristan

    cPanelTristan Quality Assurance Analyst
    Staff Member

    Joined:
    Oct 2, 2010
    Messages:
    7,623
    Likes Received:
    21
    Trophy Points:
    38
    Location:
    somewhere over the rainbow
    cPanel Access Level:
    Root Administrator
    If you would like to strip this information down to the user's domains only without the output from the entire line (not to mention, if a subdomain has addon in it, then you'll get that if you don't refine the grep):

    Code:
    #grep "=addon" /etc/userdatadomains | awk {'print $1,$2'} | cut -d= -f1 | uniq -c | sort -n
          1 addon.com: myuser
          1 addon2.com: myuser
    This represents two addon domains (addon.com and addon2.com owned by the user myuser).

    Without the = portion, I was getting the following:

    Code:
    #grep "addon" /etc/userdatadomains | awk {'print $1,$2'} | cut -d= -f1 | uniq -c | sort -n
          1 addon.com: myuser
          1 addon.domain.com: myuser
          1 addon2.com: myuser
    That's because addon.domain.com has addon in the name even though it's a subdomain. Unless you also want subdomains, you'd want to use "=addon" in the grep.

    Next, if you simply want to count the addon domains for a user without listing the domain names individually:

    Code:
    #grep "=addon" /etc/userdatadomains | awk {'print $2'} | cut -d= -f1 | uniq -c | sort -n
          2 myuser
    This outputs the count of the two addon domains that myuser owns.
     
  4. mohd_007

    mohd_007 Well-Known Member

    Joined:
    Sep 22, 2007
    Messages:
    57
    Likes Received:
    0
    Trophy Points:
    6
    cPanel Access Level:
    Website Owner
    Thanks! that's what I needed.
     
Loading...

Share This Page