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:
# plesk bin domain --list | xargs -I {} plesk bin dns --update-soa {} -soa-ttl 1D -soa-refresh 3H -soa-retry 1H -soa-expire 7D -soa-minimum 3H -soa-serial-format yyyymmddnn
-
In case some domain aliases on the server are not set to synchronize DNS with the primary domain, update SOA for aliases also:
# plesk db -Ne "select name from domain_aliases;" | xargs -I {} 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:
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: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:
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
3 comments
Note “plesk bin domain --list” does not list any domain/site aliases.
Steve Yates Yes, this command does not return domain's aliases. However, in the scope of this article it is not needed to list domain's aliases because alias domain DNS zone is synchronizing with the primary domain DNS. It means that editing SOA record for a primary domain is enough to automatically apply these changes to domain's aliases.
Hi Alexander, the problem we ran into was:
1) “Synchronize the DNS zone with the primary domain” is an option. (on/off)
2) our client had twice made a domain an alias, and then started using it as the primary domain for the site.
3) our client was not using our DNS for the alias but did not “disable” DNS for the alias domain.
4) at migration we pulled the “list of domains” and checked for those not using our name servers.
These two aliases were therefore not found, and not updated, knocking those couple of sites offline until we were able to fix it.
Please sign in to leave a comment.