#!/usr/bin/perl -w
use DBI;
use LWP::Simple qw(get);# $driver="mysql";
$dbh=DBI->connect("DBI:mysql:csunet:localhost","root","")||die"can not connect database";# 产生当天日期
$year = (gmtime time)[5] + 1900;
$month = (gmtime time)[4] + 1;
$date = (gmtime time)[3];
$today = $year."-".$month."-".$date;$sql = "select phone from duty_info where RiQi='" .$today. "'";
$sth=$dbh->prepare($sql) || die "Occur an error when query database!";
$sth->execute();
$numRows=$sth->rows;while(@row=$sth->fetchrow_array)
{
$number = $row[0];
}if($numRows == 1)
{
my $url = 'http://202.197.54.130:9999/cgi-bin/csend.exe?N=13687363993,' .$number. '&M=省网7206路由器出现故障请检查';
my $content = get $url;print $content;
print "/n";
}print "满足条件的数为: $numRows /n";
print $today;
print "/n";
print $sql;
print "/n";$sth->finish();
$dbh->disconnect();exit 0;
perl实现异常时报警
最新推荐文章于 2020-06-01 15:44:53 发布