• Our team is looking to connect with folks who use email services provided by Plesk, or a premium service. If you'd like to be part of the discovery process and share your experiences, we invite you to complete this short screening survey. If your responses match the persona we are looking for, you'll receive a link to schedule a call at your convenience. We look forward to hearing from you!
  • We are looking for U.S.-based freelancer or agency working with SEO or WordPress for a quick 30-min interviews to gather feedback on XOVI, a successful German SEO tool we’re looking to launch in the U.S.
    If you qualify and participate, you’ll receive a $30 Amazon gift card as a thank-you. Please apply here. Thanks for helping shape a better SEO product for agencies!
  • The BIND DNS server has already been deprecated and removed from Plesk for Windows.
    If a Plesk for Windows server is still using BIND, the upgrade to Plesk Obsidian 18.0.70 will be unavailable until the administrator switches the DNS server to Microsoft DNS. We strongly recommend transitioning to Microsoft DNS within the next 6 weeks, before the Plesk 18.0.70 release.
  • The Horde component is removed from Plesk Installer. We recommend switching to another webmail software supported in Plesk.

Bulk nameserver change

vincenzot

Regular Pleskian
Hello,

there is any method to do an bulk nameserver change in all domains into my server (about 3 server with 400 domains for each one)?

I have need to change my old NS:

FROM

ns1.name_server.domain.tld
ns2.name_server.domain.tld
secondaryns.domain.tld

TO

name_server.domain.tld
2nd_ns.domain.tld
3nd_ns.domain.tld
4nd_ns.domain.tld

So, exist any functions on Plesk for do that?

Thanks you guys.
 
I doubt it can be done within Plesk, but you can script making the changes directly in the database and then push a complete reconfiguration of bind from the database, using this command :

mysql -Ns -uadmin -p`cat /etc/psa/.psa.shadow` -D psa -e 'select name from dns_zone' | awk '{print "/usr/local/psa/admin/sbin/dnsmng update " $1 }' | sh



(this is from some KB article that I can no longer find).
 
First you should update Server Settings > DNS Template in Plesk Panel.
Then you should make modifications in database psa table dns
mysql> update dns_recs set displayVal = 'ns1.new.tld.', val = 'ns1.new.tld.' where type = 'NS' and val='ns1.old.tld.';
After that you may use following script from your Plesk server:


#!/bin/bash

ADMIN_PASS=`cat /etc/psa/.psa.shadow`
MYSQL_BIN_D=`grep MYSQL_BIN_D /etc/psa/psa.conf | awk '{print $2}'`
mysql="${MYSQL_BIN_D}/mysql -N -uadmin -p${ADMIN_PASS} psa"
UNIXTST=`date +%s`
NORMTST=`date +%Y%m%d%M`

# Updating SOA serial record
querytimeu="update dns_zone set serial=$UNIXTST where serial_format='UNIXTIMESTAMP';"
querytimen="update dns_zone set serial=$NORMTST where serial_format='YYYYMMDDNN';"
echo $querytimeu | $mysql
echo $querytimen | $mysql

query="select name from domains;"
query2="select name from domainaliases;"
domains=`echo $query | $mysql `
daliases=`echo $query2 | $mysql `

echo "Updating zones for following domains"
echo "-----------------------------------------------------------------"
for i in ${domains}; do
echo "$i"
/usr/local/psa/admin/sbin/dnsmng update $i
done
echo "-----------------------------------------------------------------"
echo "All domains have been updated"
echo "Updating zones for following aliases"
echo "-----------------------------------------------------------------"
for i in ${daliases}; do
echo "$i"
/usr/local/psa/admin/sbin/dnsmng update $i
done
echo "-----------------------------------------------------------------"
echo "All aliases have been updated"
 
Hi Insider,

Your script worked great!
I used it to change bulk a-records.
But it allready changed after the rule: update dns_recs set displayVal = 'ns1.new.tld.', val = 'ns1.new.tld.' where type = 'NS' and val='ns1.old.tld.';

Why is there the need to run the script after?
Because when I run this script, then I get the following error:

dnsmng: Some parameters in command string are left unprocessed. Check parameters please.
System error 2: No such file or directory
domain.com


Did you know why? Or what to do.
And is there the need to run the script after?

Best regards,

-->> UPDATE
I find also the following script, and this works good!
Is this the same?

#!/bin/sh

ADMIN_PASS=`cat /etc/psa/.psa.shadow`
MYSQL_BIN_D=`grep MYSQL_BIN_D /etc/psa/psa.conf | awk '{print $2}'`
mysql="${MYSQL_BIN_D}/mysql -N -uadmin -p${ADMIN_PASS} psa"

query="select name from domains;"
domains=`echo $query | $mysql `

for i in ${domains}; do
echo "echo $i"
/usr/local/psa/admin/sbin/dnsmng --update $i
done


First you should update Server Settings > DNS Template in Plesk Panel.
Then you should make modifications in database psa table dns
mysql> update dns_recs set displayVal = 'ns1.new.tld.', val = 'ns1.new.tld.' where type = 'NS' and val='ns1.old.tld.';
After that you may use following script from your Plesk server:


#!/bin/bash

ADMIN_PASS=`cat /etc/psa/.psa.shadow`
MYSQL_BIN_D=`grep MYSQL_BIN_D /etc/psa/psa.conf | awk '{print $2}'`
mysql="${MYSQL_BIN_D}/mysql -N -uadmin -p${ADMIN_PASS} psa"
UNIXTST=`date +%s`
NORMTST=`date +%Y%m%d%M`

# Updating SOA serial record
querytimeu="update dns_zone set serial=$UNIXTST where serial_format='UNIXTIMESTAMP';"
querytimen="update dns_zone set serial=$NORMTST where serial_format='YYYYMMDDNN';"
echo $querytimeu | $mysql
echo $querytimen | $mysql

query="select name from domains;"
query2="select name from domainaliases;"
domains=`echo $query | $mysql `
daliases=`echo $query2 | $mysql `

echo "Updating zones for following domains"
echo "-----------------------------------------------------------------"
for i in ${domains}; do
echo "$i"
/usr/local/psa/admin/sbin/dnsmng update $i
done
echo "-----------------------------------------------------------------"
echo "All domains have been updated"
echo "Updating zones for following aliases"
echo "-----------------------------------------------------------------"
for i in ${daliases}; do
echo "$i"
/usr/local/psa/admin/sbin/dnsmng update $i
done
echo "-----------------------------------------------------------------"
echo "All aliases have been updated"
 
Last edited:
Back
Top