Web Hosting Talk







View Full Version : Bulk DNS change (group operation) - via SSH?


DennisCitus
05-17-2008, 01:25 PM
We are going to switch from shared DNS to dedicated DNS servers located at different places in The Netherlands.

Yet I have to update my DNS records to do so.
How is this done for 500 domains at a time?

for all domains ending with tld==nl
replace ns1.hostdomain.nl with dns1.server.nl
replace ns2.hostdomain.nl with dns2.server.nl

We are using Plesk.

gosha
05-18-2008, 04:04 AM
You should use something like:

for F in `grep "something to find domain files"` ; \
do vi -c "%s/ns1.hostdomain.nl/dns1.server.nl/g" -c "wq" $F; done

Not sure about for loop syntax, I have no linux in hands.
vi -c opens a file and execute a command

gplhost
05-18-2008, 05:45 AM
This should do the trick:

for i in `ls *.nl` ; do sed -i 's/ns1.hostdomain.nl/dns1.server.nl/' $i ; done

Thomas

DennisCitus
06-07-2008, 11:11 AM
That really helped me out! I am sorry I didn't show my gratitude by replying last time.

I currently need to replace:

allow-transfer {
x.50;
x.17;



allow-transfer {
x.7;
x.15;

Seems quite a hell of a job to me. Even using bash or perl code, doesn't seem like an easy job.