• The Horde webmail has been deprecated. Its complete removal is scheduled for April 2025. For details and recommended actions, see the Feature and Deprecation Plan.
  • We’re working on enhancing the Monitoring feature in Plesk, and we could really use your expertise! If you’re open to sharing your experiences with server and website monitoring or providing feedback, we’d love to have a one-hour online meeting with you.

Question about "Apply DNS Template Changes"

Chris1

Regular Pleskian
I am currently in the process of migrating a few hundred domains from one server to another using Plesk's Migration & Transfer Manager. The servers have the following name servers allocated:

Server 1: ns9.example.com & ns2.example.com
Server 2: ns1.example.com & ns2.example.com

In the DNS Zone Template in Tools & Settings on Server 2, can I just click Apply DNS Template Changes and change all migrated domains NS records to ns1/ns2? Will this affect custom DNS entries as a lot of the domains have DNS changes that need to remain. I'm just hoping that this might be a quicker way than going into each domains DNS zone and manually changing ns9 to ns1.

I just really don't want all the domains DNS zones to reset to the standard template on Server 2 :/

Kind regards,
Chris
 
I place the correct template on a server before the migration and use this script after the migration, run from the commandline

<?php

$nsold1 = "ns9.example.com";
$nsold2 = "ns2.example.com";

$nsnew1 = "ns1.example.com";
$nsnew2 = "ns2.example.com";


$pwfile = "/etc/psa/.psa.shadow";

$pw = trim(file_get_contents($pwfile));

mysql_connect("localhost","admin", $pw);
mysql_select_db("psa");

if (!($result=mysql_query("select name from dns_zone ORDER by name;"))) {
print("MySQL error: " . mysql_error());
}

$aantal = mysql_num_rows($result);
echo "$aantal domains found ... Starting domains\n";
for ($r = 0; $r < mysql_num_rows( $result); $r++) {
$row = mysql_fetch_array ($result);
$domdone = shell_exec("/usr/local/psa/bin/dns -d $row[0] -ns '' -nameserver $nsold1");
echo "$domdone";
$domdone = shell_exec("/usr/local/psa/bin/dns -a $row[0] -ns '' -nameserver $nsnew1");
echo "$domdone";
$domdone = shell_exec("/usr/local/psa/bin/dns -d $row[0] -ns '' -nameserver $nsold2");
echo "$domdone";
$domdone = shell_exec("/usr/local/psa/bin/dns -a $row[0] -ns '' -nameserver $nsnew2");
echo "$domdone";
}

?>


-d = delete
-a = add

hope this helps

regards
Jan
 
Thank you!

So this will only change NS records in each zone? All other DNS records will stay as they are?

Kind regards,
Chris
 
Thank you very much.

Could you please let me know how I can just run it on one domain only?

I would assume I have to edit the for loop parameters but I don't really know PHP that well.

Kind regards,
Chris
 
Last edited:
No need to change the script, you can run the plesk cli command only to test it.

/usr/local/psa/bin/dns -d domain.com -ns '' -nameserver dnsname
/usr/local/psa/bin/dns -a domain.com -ns '' -nameserver dnsname

or incorperate the cli command in a script languange you are familiair with.

regards
Jan
 
Back
Top