Subversion Repositories sysadmin_scripts

Rev

Rev 80 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 80 Rev 81
Line 1... Line 1...
1
#! /usr/bin/env perl
1
#! /usr/bin/env perl
2
 
2
 
3
use strict;
3
use strict;
4
use warnings;
4
use warnings;
5
 
5
 
-
 
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
6
# ls /var/www/ | grep '^.*\..*$' | grep -v '^quota' | ./doWeHost.pl
14
# ls /var/www/ | grep '^.*\..*$' | grep -v '^quota' | ./doWeHost.pl
-
 
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
7
 
19
 
-
 
20
# the IP address of the web hosting machine (ie, this machine)
8
my $myIP = '74.113.60.152';
21
my $myIP = '74.113.60.152';
9
 
-
 
-
 
22
# the IP address of a remote DNS server
10
my $dnsServer = '9.9.9.9';
23
my $dnsServer = '9.9.9.9';
11
 
24
 
12
while ( my $domain = <> ) {
25
while ( my $domain = <> ) {
13
   chomp $domain;
26
   chomp $domain;
14
   my $result = `dig +short \@$dnsServer $domain`;
27
   my $result = `dig +short \@$dnsServer $domain`;