Is there a command to delete a domain without the control panel? (vacating an old BSD server)?

IT_Architect

Verified User
Joined
Feb 27, 2006
Messages
1,088
Is there a command to delete a domain without the control panel? (vacating an old BSD server)?

Thanks!
 
Yes why not, you have to delete them from all files and directory's the domain is in. At least for total cleanup. Maybe not all of this is necessary, but I would delete these files and directory's.

Like within /usr/local/directadmin/data/users/user/domains
within /usr/local/directadmin/data/users/user/domain.list
within /usr/local/directadmin/data/users/user/httpd.conf
within /usr/local/directadmin/data/users/user/DocumentRoot.cache.json
/home/user/imap
/home/user/domains
other files like
/etc/dovecot/sni
/etc/virtual/
within /etc/named.conf
/var/named/domain.db

Maybe some less important like:
/usr/local/directadmin/data/.lego/certificates/
/var/log/httpd/domains/

There might be more but these are the ones I know.
 
Thank you for your response.

The issue for me is I cannot move them all at the same time to another server. Even after I change the DNS pointers at the registrar, if the domains still exist on the current old server, emails from domains still active on the old server will be sent to the no-longer-active domain on the old server instead of where it is currently active.

I was hoping there was a command to guarantee getting everything as if the control panel did it but I will try it using the steps you have suggested.

Thanks again!
 
You're welcome.
There is probably a method which you mean via a script using the CLI/API options, but I'm no coder so I don't know how this works.

However, check this thread.

it's to delete a user via cmd_api but maybe you're better into that kind of api scripting and you can create something similar to remove a domain.
 
Oh even better:
 
Thank you for your response.

The issue for me is I cannot move them all at the same time to another server. Even after I change the DNS pointers at the registrar, if the domains still exist on the current old server, emails from domains still active on the old server will be sent to the no-longer-active domain on the old server instead of where it is currently active.
Your issue could be dns propagation, when you change DNS it could take a while before it reflects everywhere. (changes can take up to 72 hours, usualy much less.)
 
Oh even better:
There is a lot of code missing there. I'll look into now that I know it is possible. That would remove a domain without missing stuff.

Thanks!
 
Your issue could be dns propagation, when you change DNS it could take a while before it reflects everywhere. (changes can take up to 72 hours, usually much less.)
When you send email from one domain to another on the same server, the resolution is done locally so DNS propagation doesn't factor into it.

I've have the TTLs set at 300 seconds for days anyway, making the average half that, so I can prove it works fine in minutes and switch back if it doesn't. For those that don't respect the TTL, I don't care when they catch up as long as I know everything is working.

Thanks!
 
Last edited:
When you send email from one domain to another on the same server, the resolution is done locally so DNS propagation doesn't factor into it.

I've have the TTLs set at 300 seconds for days anyway, making the average half that, so I can prove it works fine in minutes and switch back if it doesn't. For those that don't respect the TTL, I don't care when they catch up as long as I know everything is working.

Thanks!
Ahh okay yes i understand now, haha.
 
Oh even better:
I believe I will have to go with your original because it is an old DA and thus the license cannot be updated so the API isn't likely to work either.
 
Back
Top