Bulk update DNS zones on cPanel

Categories: cPanel/WHM, DNS

Back up ALL DNS Zonefiles.

cp -rpf /var/named /var/named.backup

Update the Nameserver’s in ALL DNS Zonefiles

replace "cpanel1.company.net" "cpdns1.company.net" -- /var/named/*.db

Update the Serial/Timestamp in ALL DNS Zonefiles:

grep "serial, todays" /var/named/*.db | sed "s/://g" | cut -d/ -f4 | awk {'system("replace "$2" "strftime("%Y%m%d")"00 -- /var/named/"$1)'}

sync all zones to cluster

/usr/local/cpanel/scripts/dnscluster syncall --full

check zones synced on slave

/usr/local/cpanel/whostmgr/bin/dnsadmin --action GETZONELIST --localonly|wc -l

References:
https://forums.cpanel.net/threads/bulk-dns-zone-update.351991/
http://ly9b.blogspot.com/2019/08/cpanel-dns-cluster-force-sync-zones-to.html

»