Applicable to:
- Plesk for Linux
- Plesk for Windows
Question
It is required to change SOA record value (TTL) for all domains hosted in Plesk. How to do it in bulk for all domains?
Answer
Note: the further instructions are intended for server administrators with direct RDP/SSH access to the server. If direct SSH/RDP access to the server is not possible, contact server administrator for further assistance.
Click on a section to expand
-
Connect to the server using SSH.
-
Create Plesk database backup and perform the update:
# MYSQL_PWD=`cat /etc/psa/.psa.shadow` mysqldump -uadmin psa > /root/psa_db_backup`date +%F`.sql
-
Execute the following script to update SOA for all domains:
# sudo plesk bin domain --list | xargs -I {} sudo plesk bin dns --update-soa {} -soa-ttl 1D -soa-refresh 3H -soa-retry 1H -soa-expire 7D -soa-minimum 3H -soa-serial-format yyyymmddnn
Check the following documentation for the details about --update-soa parameters on Linux
-
Log into the server via RDP.
-
Create a backup for psa database:
C:\> plesk db dump psa > C:\psa.sql
-
Verify that
C:\psa.sql
was created physically -
Generate a list of all domains to
C:\domains.txt
file:C:\> plesk db -Ne "select name from domains;" > C:\domains.txt
-
Run the command below to set TTL as 5 minutes for all domains from the C:\domains.txt file:
C:\> for /f "tokens=*" %d in ('type C:\domains.txt') do plesk bin dns --update-soa %d -soa-ttl 5M
Check the following documentation for the details about --update-soa parameters on Windows
Comments
6 comments
I think it would be a good idea to also update the serial field, otherwise slave DNS servers will not update!
@Seb, Sounds like a good feature! Please, provide this suggestion on our Plesk User Voice https://plesk.uservoice.com/forums/184549-feature-suggestions .
Wouldn't it be safer and more consistent to use the Plesk Linux CLI commands to achieve this?
So for Plesk Onyx running on Ubuntu Linux you could use:
sudo plesk bin domain --list | xargs -I {} sudo plesk bin dns --update-soa {} -soa-ttl 1D -soa-refresh 3H -soa-retry 1H -soa-expire 7D -soa-minimum 3H
to reset all domains to the (current) SOA defaults.
@Maghreb Updated the article, thank you!
I'm about to migrate from an old Plesk 11 install, to a current version, on new hardware, with a new server provider. I'd like to know methods for updating all TTLs on Plesk 11 (CentOS), in preparation for the migration. Then how to switch the TTLs back to defaults, once running on the new server, with the new Plesk version.
What, if any, modifications to the steps on the page would be required under Plesk 11 (CentOS)?
Hello @Bob B,
>> What, if any, modifications to the steps on the page would be required under Plesk 11 (CentOS)?
The current article is applicable for Plesk 12.5 version and higher. Plesk 11 has reached the end-of-life and is not supported anymore so I can not guarantee these steps will work in Plesk 11 version.
Please try to use solution from this article and if it does not help, consider upgrade from Plesk 11 to Plesk 12.5. Then apply the solution from this article and then migrate data to the new server.
>> Then how to switch the TTLs back to defaults, once running on the new server, with the new Plesk version.
The steps are the same. You minimize the DNS propagation time before migration by changing the TTL to 1H/3600 seconds (or another value):
# sudo plesk bin domain --list | xargs -I {} sudo plesk bin dns --update-soa {} -soa-ttl 1H
After migration you can change back to the default TTL value 1D /86400 seconds using the same command:
# sudo plesk bin domain --list | xargs -I {} sudo plesk bin dns --update-soa {} -soa-ttl 1D
Please sign in to leave a comment.