List Subdomains from Shell
I'm looking for a way to generate a list of subdomains in the shell, similar to Account Information > List Subdomains in the interface.
Usually I do something like cat /etc/domainusers which is great, but doesn't list out these subdomains. I have like 2000 domains that need to be pruned from the server, but need an easy list to loop through removing them.
Thank you.
-
There is also information stored in /var/cpanel/userdata/%user%/main Although the API is probably the better way to accomplish this. 0 -
Hello @dstana, You may also find the following WHM API 1 function helpful: WHM API 1 Functions - get_domain_info - Developer Documentation - cPanel Documentation One of the returns is "domain_type", which will tell you if it's a subdomain. Thank you. 0 -
If you are looking to parse this for every user, then probably parsing the YAML file (why isn't this in json?) will be faster. But the API is probably the best way to guarantee that this will work. 0
Please sign in to leave a comment.
Comments
4 comments