Subversion Repositories sysadmin_scripts

Rev

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

Rev Author Line No. Line
80 rodolico 1
#! /usr/bin/env perl
2
 
3
use strict;
4
use warnings;
5
 
81 rodolico 6
# this is a filter. A list of domains is passed on STDIN
7
# for each domain, it will check that the DNS record matches
8
# $myIP and, if it does not, will display the domain on 
9
# STDOUT.
10
 
11
# Strongly recommend you verify before deleting any web sites, however.
12
 
13
# A sample call is
80 rodolico 14
# ls /var/www/ | grep '^.*\..*$' | grep -v '^quota' | ./doWeHost.pl
81 rodolico 15
# this gets all domains listed in /var/www which contain at least one
16
# period. Since the quota controls for ISPConfig are in here and have
17
# a period in their filenames, we use grep -v to exclude them
18
# that list is then piped to the script on STDIN
80 rodolico 19
 
81 rodolico 20
# the IP address of the web hosting machine (ie, this machine)
80 rodolico 21
my $myIP = '74.113.60.152';
81 rodolico 22
# the IP address of a remote DNS server
80 rodolico 23
my $dnsServer = '9.9.9.9';
24
 
25
while ( my $domain = <> ) {
26
   chomp $domain;
27
   my $result = `dig +short \@$dnsServer $domain`;
28
   print "$domain\n" unless $result =~ m/$myIP/;
29
}