GregorDHH

Registered
Mar 26, 2020
2
0
1
Slovenia
cPanel Access Level
Root Administrator
I need to rename multiple addon/alias domains so I'm writing a script to do that.

Idea is to delete them and recreate them with new names. If there is a better way to do that, please let me know.


First I would need to know what actually gets deleted when removing addon/alias so I can backup this data beforehand.

For aliases documentation states:
- alias
- vhost entries
- DNS entries
are removed: Aliases | cPanel & WHM Documentation

I see these things also get deleted:
/etc/valiases/$DOMAIN
/etc/vfilters/$DOMAIN
/var/cpanel/userdata/${USER}/${DOMAIN}
/var/cpanel/userdata/${USER}/${DOMAIN}_SSL

Is there anything else that gets deleted when removing addon/alias domain?
 

cPanelLauren

Forums Analyst II
Staff member
Nov 14, 2017
10,088
877
313
Houston
Why not use the API to add/remove them rather than modify the files directly which may or may not be recognized by cPanel fully?

Create a parked/alias domain:

Create an addon domain

Remove a parked/alias domain:

Remove an addon domain:
 

GregorDHH

Registered
Mar 26, 2020
2
0
1
Slovenia
cPanel Access Level
Root Administrator
That is my plan.

But I also need to copy and modify things that do get deleted if I don't want to loose this information:

/var/named/${DOMAIN}.db
/etc/valiases/${DOMAIN}
/etc/vfilters/${DOMAIN}
/var/cpanel/userdata/${USER}/${DOMAIN}
/var/cpanel/userdata/${USER}/${DOMAIN}_SSL

Does anything else get deleted when removing addon/parked domain?