Add DNS record via CLI

2 posts / 0 new
Last post
#1 Thu, 11/20/2014 - 11:23

Add DNS record via CLI


To add a DNS record to a specific domain via CLI I can use this command: modify-dns --domain --add-record " A"

But how can I add a DNS record to all domains so that "" is replaced with the correct domain name?

modify-dns --all-domains --add-record "foo A" ?


Fri, 11/21/2014 - 16:51


Try the following:

virtualmin list-domains --name-only | while read line ; do virtualmin modify-dns --domain-name $line --add-record "$line A" ; done

That should work, I don't have a server I can test it on though so let me know if you have any issues. You only need to replace the IP address ( with what you want.


Topic locked