Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!

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:
    56
    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.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  2. cPanelMichael

    cPanelMichael Technical Support Community Manager
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    45,214
    Likes Received:
    1,936
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Twitter:
    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.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  3. cPanelTristan

    cPanelTristan Quality Assurance Analyst
    Staff Member

    Joined:
    Oct 2, 2010
    Messages:
    7,608
    Likes Received:
    32
    Trophy Points:
    238
    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.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  4. mohd_007

    mohd_007 Well-Known Member

    Joined:
    Sep 22, 2007
    Messages:
    57
    Likes Received:
    0
    Trophy Points:
    56
    cPanel Access Level:
    Website Owner
    Thanks! that's what I needed.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
Loading...

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice