Sticky NS Problem after Copy multiple accounts

connorlong

Member
Feb 23, 2005
23
0
151
:eek:

I have successfully copied multiple accounts from Server A to Server B using WHM.

The problem is that server B has different NS from server A. Each account copied has the NS of Server A. I can change this 1 by 1. Is there a way to do the whole lot in one go?

Thank you
 

designeru

Well-Known Member
Nov 2, 2005
83
0
156
Hint!

You can use the following code to chage the nameservers from all the accounts you have to the one you need. Please do backups before. This script was never tested.
dom=` cat /root/domains `
for i in $dom
do
cat /var/named/$i | sed
s/ns1.nameserver.old/ns1.nameserver.new/g | sed
s/ns2.nameserver.old/ns2.nameserver.new/g >/root/$i
done
Note!
In /root/domains you have a list of the websites you wish to change + termination ".db" at the end of each domain (eg. www.domain.com.db NOT the name of the account, eg. domainc.db)

To create those domain.com.db file for the reseller "reseller_name" you can use this script. For all resellers, just delete the reseller name.
grep "OWNER=reseller_name" /var/cpanel/users/* | awk -F/ '{print $5;}' |
awk -F: '{print $1;}' | xargs cat | grep DNS= | awk -F= '{print $2
".db";}' >/root/domains
Please let me know if this helped anyone.