Articles in this section

How to change TTL value for SOA records on all domains on Plesk server?

Plesk for Windows kb: how-to Plesk for Linux ABT: Group B

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

For Linux
  1. Connect to the server using SSH

  2. 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

  3. 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

  4. 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

For Windows
  1. Log into the server via RDP.

  2. Start a command prompt as an administrator.

  3. Create a backup for psa database:

    plesk db dump psa > C:\psa.sql

  4. Verify that C:\psa.sql was created physically

  5. Generate a list of all domains to C:\domains.txt file:

    plesk db -Ne "select name from domains;" > C:\domains.txt

  6. 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

Was this article helpful?

Comments

3 comments
Date Votes
  • Note “plesk bin domain --list” does not list any domain/site aliases.

    0
  • 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.

    0
  • 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.

    0

Please sign in to leave a comment.