Question
How to add a DNS record to multiple domains via CLI on a Plesk Linux server?
Answer
- Log into the server via SSH.
- Using the command below, create the list of all domains with physical hosting enabled:
# MYSQL_PWD=`cat /etc/psa/.psa.shadow` mysql -u admin psa -Ne”select name from domains where htype=’vrt_hst'” > /root/domains.txt
Note: modify
/root/domains.txt
and exclude the domains that should be left intact. - Run the following command to add DNS record for the domains from the
/root/domains.txt
file:# cat /root/domains.txt | while read i; do plesk bin dns –add $i -ns ns3 -nameserver example.net;done
Note: in the example above the name server example.net will be added for all domains from the
/root/domains.txt
file.For additional options for adding DNS records via CLI please refer: dns: DNS Zones on Domains .