SuSE Ping Perl Script

Post general support questions here that do not specifically fall into the Linux or Windows categories.

Moderators: Developers, Moderators

Post Reply
User avatar
digger
Posts: 23
Joined: Tue Mar 05, 2002 7:00 pm
Location: Ft. Thomas, KY
Contact:

Post by digger »

Maybe not much to discuss here but I wanted to document this for other people good should they need it. The Perl script ping.pl did not work on SuSE 7.3. The reason is that the script was greping for "round-trip" but the ping utility in SuSE 7.3 uses "rrt" instaed inthe summary portion of the command's output. I found two ways to correct this.

First I told the script to grep for "rrt". This solved the problem for SuSE.

Second I realised that this was also not a cross platform solution so I make my script as follows.

===========================
#!/usr/bin/perl

if ($ARGV[0]=="x") {
$db = ":0";
$ARGV[0] = 2;
}

$response = `ping $ARGV[1] -c $ARGV[0] |grep "min/avg/max"| awk '{print $4 }' | awk -F / '{print $1 }' | grep -v "War$
chomp $response;
$response = $response;
print "$response$db";
============================

I hope this helps someone out there in the future.

<font size=-1>[ This Message was edited by: digger on 2002-03-06 13:42 ]</font>
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests