Web Hosting Talk







View Full Version : Mass checking nameservers server script?


midnightz
06-05-2007, 09:46 AM
Hello all :)

Is there a script that exist or other wise, where a script can be run on your server to see what domains still resolve. We did a large migration and want to clean house but of course don't want to check a trace and-or lookup for every domain on the server.

I could have sworn, I have seen this script before (or maybe in a dream).

Checking each domain to see if it resolves to our name servers is just way to time consuming.

Thanks,
Amy

bilalk
06-05-2007, 01:31 PM
You should be able to write one up fairly quickly in your language of choice.

Off the top of my head, for PHP:


<?php
// Set the following to a file that lists one domain per line
$domainsFile = "/path/to/domains.txt";

// Set the following to the IP address of your new server
$serverIP = "0.0.0.0";

// END CONFIGURATION //

foreach (file($domainsFile) as $domain) {
print "{$domain}... ";

if (gethostbyname($domain) == $serverIP)
print "OK\n";
else
print "INCORRECT\n";
}
?>


This should attempt all of your domains to see if they resolve to your new server.
Should take a fraction of a second per domain, depending on your resolving nameserver.
(Make sure you run it with a different nameserver than your authoritative one!)