Admin-Ahead Community

Windows => Control Panels => Plesk => Topic started by: jominj on February 09, 2014, 10:44:27 pm

Title: How to change TTL value for all the SOA records on all Domains
Post by: jominj 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.
)