How to update v-list-dns-domains IP data

I am generating reports using the command line tools and a specific requirement I have is to find which domains have a particular A record, so I wrote a quick script using v-list-users and v-list-dns-domains.
I noticed that the IP address given in the output of v-list-dns-domains is incorrect, and after a bit of digging worked out that it is the one set in /usr/local/hestia/data/users/<username>/dns/<domainname>/dns.conf. which appears to be the one that was created when the domain was created.
Now I know this I can write a script to get the IP address I need using v-list-dns-records but is it possible to update the IP address in dns.conf so it shows, for example, the top level A record?

You can use v-change-dns-domain-ip script:

Example:

v-change-dns-domain-ip theuser example.net 203.0.113.1

If you want to replace the ip by the one that appears in the A record for root domain, you should create a script to extract the ip.

Example extracting the ip assigned to example.net domain:

v-list-dns-records theuser example.net | awk '/^[1-9][0-9]{0,}\s{1,}@\s{1,}A/ {print $4}' | head -n1
1 Like