Get your server issues fixed by our experts for a price starting at just 25 USD/Hour. Click here to register and open a ticket with us now!

Author Topic: How to change TTL value for all the SOA records on all Domains  (Read 2822 times)

0 Members and 1 Guest are viewing this topic.

jominj

  • Guest
How to change TTL value for all the SOA records on all Domains
« on: February 09, 2014, 10:44:27 pm »
We can change the TTL vlaue for all the SOA records for all domains in bulk using a script.

Please take a plesk panel database backup before executing the script. Use the following command
Code: [Select]
`"%plesk_dir%\MySQL\bin\mysqldump.exe" -uadmin -p*** -P 8306 psa > "C:\psa_backup.sql"`
The script content is as follows:
Code: [Select]
@echo off

"%plesk_dir%\MySQL\bin\mysql.exe" -uadmin -p*** -P 8306 psa -sNe "select name from dns_zone;" > "C:\domains_list.txt"

for /f "tokens=*" %%a in (C:\domains_list.txt) do (
        "%plesk_dir%\MySQL\bin\mysql.exe" -uadmin -p*** -P 8306 psa -sNe "update dns_zone set ttl='900', ttl_unit='60' where name='%%a';"
        "%plesk_dir%\admin\bin\DNSMng.exe" UPDATE %%a
        echo Update of domain %%a finished.
)