[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Fixed pingit script
- To: aroot@ops.ietf.org
- Subject: Fixed pingit script
- From: Harald@Alvestrand.no
- Date: Fri, 13 Oct 2000 13:51:51 +0200
- Delivery-date: Fri, 13 Oct 2000 04:53:36 -0700
- Envelope-to: aroot-data@psg.com
Rather than checking that the last line contains aroot.psg.com, it now checks that the last line ends in "digit" ms.
Please tst.
Harald
#!/usr/bin/perl
# Ping the aroot nameserver, finding out where it is
$date = `date +%Y-%m-%dT%H:%M`;
chop $date;
$tracert = `/usr/sbin/traceroute -f 9 aroot.psg.com 2>/dev/null | tail -2`;
($prev, $last) = split(/\n/, $tracert);
($hopc, $hostp, $ip, $delay) = split(/\s+/, $prev);
($hopc, $host, $ip, $delay) = split(/\s+/, $last);
if ($last =~ /\d ms$/) {
print "$date SUCCESS $hopc $delay $hostp/$host\n";
} else {
# For debug of FAILURE algo:
print "# $prev\n";
print "# $last\n";
print "$date FAILURE $hopc $delay $host\n";
}