Subversion Repositories sysadmin_scripts

Rev

Rev 80 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

#! /usr/bin/env perl

use strict;
use warnings;

# this is a filter. A list of domains is passed on STDIN
# for each domain, it will check that the DNS record matches
# $myIP and, if it does not, will display the domain on 
# STDOUT.

# Strongly recommend you verify before deleting any web sites, however.

# A sample call is
# ls /var/www/ | grep '^.*\..*$' | grep -v '^quota' | ./doWeHost.pl
# this gets all domains listed in /var/www which contain at least one
# period. Since the quota controls for ISPConfig are in here and have
# a period in their filenames, we use grep -v to exclude them
# that list is then piped to the script on STDIN

# the IP address of the web hosting machine (ie, this machine)
my $myIP = '74.113.60.152';
# the IP address of a remote DNS server
my $dnsServer = '9.9.9.9';

while ( my $domain = <> ) {
   chomp $domain;
   my $result = `dig +short \@$dnsServer $domain`;
   print "$domain\n" unless $result =~ m/$myIP/;
}