Article ID: 120025, created on Feb 7, 2014, last review on Jul 17, 2016

  • Applies to:
  • Plesk 12.5 for Linux
  • Plesk 12.0 for Linux
  • Plesk 11.5 for Linux
  • Plesk 12.5 for Windows
  • Plesk 12.0 for Windows
  • Plesk 11.5 for Windows


It is required to change SOA record value (TTL) for all domains. How to do it in bulk for all domains?


This can be performed by the following script:

For Linux:

Before executing the script create Plesk database backup:

# MYSQL_PWD=`cat /etc/psa/.psa.shadow` mysqldump -uadmin psa > /root/psa_db_backup`date +%F`.sql

Script content:

MYSQL_PWD=`cat /etc/psa/.psa.shadow` mysql -uadmin psa -sNe "select name from dns_zone;" > /root/domains_list

while read domain
MYSQL_PWD=`cat /etc/psa/.psa.shadow` mysql -uadmin psa -sNe "update dns_zone set ttl='900', ttl_unit='60' where name='$domain';"
done < /root/domains_list

while read domain
/usr/local/psa/admin/bin/dnsmng --update $domain
done < /root/domains_list

For Windows:

Before executing the script create Plesk database backup by the following command:

"%plesk_dir%\MySQL\bin\mysqldump.exe" -uadmin -p<admin_password> -P8306 psa > C:\psa_backup.sql

Replace the parameter <admin_password> with your actual admin password. It can be found by executing the following command in command prompt:

"%plesk_bin%"\plesksrvclient.exe -get

Script content:

@echo off

"%plesk_dir%\MySQL\bin\mysql.exe" -uadmin -p<admin_password> -P8306 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<admin_password> -P8306 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.

Search Words


query to add records in bulk way

I need to add one NS record in each and every zone file

bulk update ttl

SOA records

update the dns record of all the domains in a server at once

bulk dns record changes

Change SOA record

script to add the record to all dns zones

Change all dns records at once

a914db3fdc7a53ddcfd1b2db8f5a1b9c 56797cefb1efc9130f7c48a7d1db0f0c 01bc4c8cf5b7f01f815a7ada004154a2 29d1e90fd304f01e6420fbe60f66f838 0a53c5a9ca65a74d37ef5c5eaeb55d7f 742559b1631652fadd74764ae8be475e e335d9adf7edffca6a8af8039031a4c7 ed7be2b984f9c27de1d2dc349dc19c6d 85a92ca67f2200d36506862eaa6ed6b8 a766cea0c28e23e978fa78ef81918ab8 2a5151f57629129e26ff206d171fbb5f 46a8e394d6fa13134808921036a34da8 bd7fc88cf1b01f097749ae6f87272128 8b661cab116c79dbe6c4ac5bbdf1c8cb

Email subscription for changes to this article
Save as PDF