1 |
root |
1.1 |
#!/opt/bin/perl |
2 |
|
|
|
3 |
root |
1.2 |
use FindBin; |
4 |
root |
1.1 |
use LWP::Simple; |
5 |
|
|
|
6 |
root |
1.2 |
open my $fh, "<", "$FindBin::Bin/checklist" |
7 |
root |
1.1 |
or die "check.txt: $!"; |
8 |
|
|
|
9 |
|
|
while (<$fh>) { |
10 |
|
|
chomp; |
11 |
root |
1.3 |
next if /^#/; |
12 |
|
|
|
13 |
root |
1.1 |
my ($url, $content) = split /\t+/; |
14 |
|
|
|
15 |
root |
1.4 |
$url =~ s,^([^/]+)/,$1:34567/, if $ARGV[0] eq "-t"; |
16 |
root |
1.1 |
|
17 |
|
|
$url = "http://$url"; |
18 |
|
|
|
19 |
|
|
my $res = get $url; |
20 |
|
|
|
21 |
|
|
if ($res =~ $content) { |
22 |
|
|
print "$url OK\n"; |
23 |
|
|
} else { |
24 |
|
|
print "$url NOT OK\n"; |
25 |
|
|
print "$res\n$content\n"; |
26 |
|
|
exit 1; |
27 |
|
|
} |
28 |
|
|
} |
29 |
|
|
|