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: Change TTL value for SOA records on all domains in Linux Server  (Read 2555 times)

0 Members and 1 Guest are viewing this topic.

jominj

  • Guest
Change TTL value for SOA records on all domains in Linux Server
« on: February 07, 2014, 09:17:20 pm »
Have you faced a situation where you have to change TTL value for SOA records on all domains. Doing this manually by finding and editing SOA record for each domain will be a hectic task. Never mind we can do this in bulk using a script.

Before executing the script please create Plesk Panel database backup:
Code: [Select]
mysqldump -uadmin -p`cat /etc/psa/.psa.shadow` psa > /root/psa_`date +%F`.sql
Script content is as follows store this in a file
Code: [Select]
#/bin/sh
pass=`cat /etc/psa/.psa.shadow `

mysql -uadmin -p$pass psa -sNe "select name from dns_zone;" > /root/domains_list

while read domain
do
mysql -uadmin -p$pass psa -sNe "update dns_zone set ttl='900', ttl_unit='60' where name='$domain';"
done < /root/domains_list

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

and set execution permission #chmod +x scriptfile

Then execute the file #./scriptfile