Skip to main content

command line subdomain removal

Comments

3 comments

  • cPanelMichael
    Hello :) There are no native scripts that will remove a subdomain beyond calling API functions from the command line. You would have to use our API, or manually remove the DNS zone, cPanel user data, and the entries from all other associated files. Manually removing a subdomain could be tedious due to the number of files you must manually edit. Thank you.
    0
  • izghitu
    Hi, There are like 12000 subdomains to remove. cPanel crashes when I remove them using the api and needs to be restarted after each 10 subdomains removed. Can you please list all the locations/files where I need to remove the subdomain data manually so I can script the removal and then just regenerate the apache configs/restart cpanel and other related services? Thanks
    0
  • cPanelMichael
    [quote="izghitu, post: 1629521">There are like 12000 subdomains to remove. cPanel crashes when I remove them using the api and needs to be restarted after each 10 subdomains removed.
    Could you provide more details on how cPanel stops working? Are there any specific error messages in the /usr/local/cpanel/logs/error_log file? It's better to address this issue than to attempt to manually remove the entries in my opinion. That being said, if you want to proceed with manually removing the entries, here is a list for you to start with: /var/cpanel/users/$username /var/cpanel/userdata/$username/* /etc/userdatadomains /etc/userdomains /etc/localdomains Note that you will also need to delete the entries from the DNS zones, and rebuild the Apache configuration file after removing the entries (/scripts/rebuildhttpdconf). This does not include any passwd/shadow files for email accounts utilized for the subdomains. There are likely other files that would include entries for your subdomains, depending on what services were utilized. Thus, deleting them with our API is really the best choice. Thank you.
    0

Please sign in to leave a comment.