Removing Zone Files Not In Use, + /scripts/rebuilddnsconfig

wizzy420

Well-Known Member
Nov 13, 2007
127
2
68
Hi All!

I've found over time when moving domains from one host to another, etc that zone files get left behind. Sometimes the old zone file doesn't match the new zone file.

I know of the /scripts/rebuilddnsconfig but I am not sure if it rips out "domains not on this server"

I want to rebuild my DNSONLY servers from a fresh install. This means when I push out my domains from cPanel / WHM servers I don't want to push out the wrong domains.

So:

- Does /scripts/rebuilddnsconfig remove unused zone files, basing it's decisions only on hosts on the server? Or does it simply base the rebuild on what files are in /var/named/*.db?

- If the later, is there a way to script-o-magically remove /var/named/*.db files that exist when there is no corresponding host/virtualhost/subdomain/addon domain?

Thanks!

W
 

cPanelDavidG

Technical Product Specialist
Nov 29, 2006
11,216
13
313
Houston, TX
cPanel Access Level
Root Administrator
Hi All!

I've found over time when moving domains from one host to another, etc that zone files get left behind. Sometimes the old zone file doesn't match the new zone file.

I know of the /scripts/rebuilddnsconfig but I am not sure if it rips out "domains not on this server"

I want to rebuild my DNSONLY servers from a fresh install. This means when I push out my domains from cPanel / WHM servers I don't want to push out the wrong domains.

So:

- Does /scripts/rebuilddnsconfig remove unused zone files, basing it's decisions only on hosts on the server? Or does it simply base the rebuild on what files are in /var/named/*.db?

- If the later, is there a way to script-o-magically remove /var/named/*.db files that exist when there is no corresponding host/virtualhost/subdomain/addon domain?

Thanks!

W
Actually /scripts/cleandns is what you're looking for to clean up any left-over DNS that doesn't need to be on your server anymore. After you do this, run /scripts/rebuilddnsconfig to update the named configurations.