#!/usr/bin/perl use Time::HiRes qw(gettimeofday); $argnum = $# + 1; if ($argnum < 1) { print "Usage : $0 [URL]\n"; exit(0); } $URL = @ARGV[0]; $MSG = @ARGV[1]; my($sec, $msec) = gettimeofday(); open(FD,"wget -p $URL -O /tmp/test.html 2>&1 |") || die "Error"; $status = 1; while($line = <FD>) { if($line =~ m/failed:/) { $status = 0; } if ($line =~ m/ERROR/) { $status = 0; } } my($csec, $cmsec) = gettimeofday(); if ($status) { print "HTTP GET OK|time=",($csec - $sec) + ($cmsec/1000000 - $msec/1000000),"\n"; } else { print "HTTP GET FAILED <$MSG> |time=0\n"; }
Copyrights © - Joinc, All Rights Reserved. Inherited From - Yundream Rebranded By - Joonphil
소개
Recent Posts
Archive Posts
Tags