Does anyone know of a command line API call that can remove specific DNS zone records?
*** Before anyone suggests updating the DNS settings in the “Server Templates”, this option was already explored and currently is not suitable for my needs. ***
I want to delete a few DNS zone “records” upon post-creation of a “Top-Level” and “Sub-Level” domain.
Wouldn’t the above command remove “all” NS records for the domain? This seems a bit dangerous. What if someone wanted to remove just one NS record for example?
Well, you should probably test out the details here before making changes to a critical domain – but the help text reads:
–remove-record “name type”
So when you say “modify-dns.pl --domain mydomain.com --remove-record mydomain.com NS”, it should remove an “NS” record named “mydomain.com” – of which there could only ever be one in that zone.
Those zone records are perfectly legal, as you are required to have more than one NS record per zone, all pointing to different DNS servers which manage your zone.
Anyhoo, I created a nicely little shell script which uses the “modify-dns.pl” command to iterate through a selected list of domains and remove the offending (as i like to put it) records. It’s been tested, and runs quite smoothly. Thankfully I don’t need to remove NS records for this case.
Hrm, when I initially thought about the problem, I guess I figured it’d make more sense to refer to NS records by the right-hand side, which is typically something like ns1.domain.com.
But I guess for all other records, you’d use the left-hand side… so I dunno, I guess you’ll just have to experiment
If you find yourself needing to remove NS records, and it doesn’t do what you need, feel free to file a Support request to get Jamie to take a look, maybe it should work differently.
The next step is to expand my shell script so it deletes the rogue records based on a condition, and actually do it automatically upon post-creation of the domain (right now I simply created a batch shell script which calls my primary script which in turn removes the offending records from the selected domains)