[svlug] how to ping a dead system

Seth David Schoen schoen at loyalty.org
Mon May 1 13:17:29 PDT 2000


Ray Olszewski writes:

> Well ... when I do the same thing in perl, I use this line:
> 
>         $isitthere = system ("ping -c 2 $ipaddress >/dev/null")   ;
> 
> It works for both successful and unsuccessful pings, returning (into
> $isitthere) 0 for success, non-zero (I haven't checked the actual return
> code) for failure. So your problem is probably in the details, and since you
> (obviously) didn't quote the exact line you use in the script, we can't spot
> a detail error.

Perl also has a Net::Ping which is very nice.  It lets you define
timeout and use different methods to ping hosts.  I suspect that it's
the standard way to do pings from Perl scripts.

-- 
Seth David Schoen <schoen at loyalty.org>  | And do not say, I will study when I
Temp.  http://www.loyalty.org/~schoen/  | have leisure; for perhaps you will
down:  http://www.loyalty.org/   (CAF)  | not have leisure.  -- Pirke Avot 2:5






More information about the svlug mailing list