2

CPanel Import Tool - Update Remote DNS & Suspend


Avatar
christesla

Hi

I'm in process of migrating thousands of cPanel accounts to DA.

I've developed my own scripts to help me along the way as we want to forward DNS traffic from cPanel DNS to DA DNS until we move the nameservers over.

This is what I do right now

move accounts from cPanel Server 1 to DirectAdmin Server 1 beginning with A

once done i execute a script we wrong on cPanel server 1 so all cPanel accounts beginning with A go through DNS records and replace CPANEL_IP with DIRECTADMIN_IP

then i run a script to suspend all cpanel accounts beginning with A

last night took 11 hours moving cPanel accounts beginning with A from cPanel 1 so by the time i updated A records the data was old.

I would like cPanel import tool to do is once the migration status goes green/done it does this

1. ssh back to cpanel server

2. get the IP of the website for that user just migrated ( api.docs.cpanel.net/openapi/whm/operation/domainuserdata/ )

3. run WHM API command to change the IP in DNS to the one of DA user where IP is the one from cPanel (ie if cpanel server is 111.111.111.111 and DA server is 222.222.222.222 it'll find/replace 111.111.111.111 with 222.222.222.222 while leaving in place all other custom DNS zones. an example command is something like whmapi1 editzonerecord domain=$domain line=$line_number address=$ip_address

4. then I'd want it to suspend the cPanel account with reason "Moved to DirectAdmin DA_HOSTNAME_GOES HERE"
We currently do this will command:

for i in `cat /root/acctlist` ;do /usr/local/cpanel/scripts/suspendacct $i "moved to DA5" ;done

but we add a list of the users we migrated to /root/acclist i'm guessing you would just replace $i with the username just migrated.



this would then allow mass migrations with little work required by me!

as user ABC is migrated traffic is then instantly forwarding to DA which will avoid data loss
i could then schedule hundreds of accounts to move at once knowing they'll instantly start forwarding traffic once its finished.

its also important that it only runs the DNS change / suspend on accounts that show DONE and didn't error.

I think others would also appreciate these 2 features being added as optional, ie where you have "ignore errors" check box maybe add something like
"update cPanel DNS"
"Suspend cPanel account when complete"

A