Created
December 2, 2012 01:15
-
-
Save hpcx82/4186334 to your computer and use it in GitHub Desktop.
monitor a domain, send a mail if it is no longer "pendingDelete"
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use strict; | |
my $targetPage = $ARGV[0]; #http://www.kingtoo.com/reg/whois.asp?domain=douban.com | |
print $targetPage . "\n"; | |
my @page = `curl $targetPage | iconv -f gb2312 -t utf8`; | |
chomp @page; | |
my $domainStatus; | |
for my $line (@page) | |
{ | |
if($line =~ /Status: (\w+)/) | |
{ | |
$domainStatus = $1; | |
print $domainStatus; | |
print "\n"; | |
} | |
} | |
if ($domainStatus eq "pendingDelete") | |
{ | |
print "The domain is still in pending state\n"; | |
} | |
else # as soon as the status is changed away from "pendingDelete", notify us! | |
{ | |
my $message = "Hi, Baiyan:\n The domain: $targetPage is ready, please register ASAP\n"; | |
my $sendmail = "echo '$message' | mail -s 'Urgent: Please register the domain!!!' baiyanhuang\@126.com"; | |
#print $sendmail; | |
print "sending mail...\n"; | |
print `$sendmail`; | |
} |
对于非pendingDelete的域名,行为是不正确的,但是现在我只care那个域名。。。
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
$ perl monitorweb.pl "http://www.kingtoo.com/reg/whois.asp?domain=douban.com"
http://www.kingtoo.com/reg/whois.asp?domain=douban.com
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 29598 100 29598 0 0 12139 0 0:00:02 0:00:02 --:--:-- 12768
ok
sending mail...