We’ve got a project coming up that will require us to have a list of every A record and nameserver for domains hosted (or partially hosted) on our cPanel servers.
This is a bash script for listing out those details, feel free to tinker and edit it to get the details or functionality you need.
#!/bin/bash for filename in /var/named/*.db; do f=$(basename "$filename") domain="${f%.*}" ipaddress=`dig $domain +short` nameserver=`whois $domain | grep "Name Server" | cut -d ":" -f 2 | sed 's/ //' | sed -e :a -e '$!N;s/ \n/,/;ta'` echo -e "$domain = $ipaddress, $nameserver" done
Leave a Reply