Canned "ping"

Canned "ping"

Post by Steve Cribb » Mon, 18 Jan 1999 04:00:00



    Within a ksh script, I would like to first determine whether or not
a remote
host is alive before I attempt other network access to it, (file reads
or writes).
The ping command seems to be the logical solution, but if I have to wait
for
the ping command to fail due to network time-out to indicate that the
remote
host is not available I've gained nothing over just letting my other
network
access commands time-out.

    Is there a way to execute ping wrapped in a timer - such as in a
subprocess
that gets killed by it's parent if it doesn't end within a practical
time interval?
It seems to me that that should work, but what I'm really looking for is

someone who would share code that has already been written.

    Much appreciated.

 
 
 

Canned "ping"

Post by Peter Smulder » Mon, 18 Jan 1999 04:00:00



>     Within a ksh script, I would like to first determine whether or not
> a remote
> host is alive before I attempt other network access to it, (file reads
> or writes).
> The ping command seems to be the logical solution, but if I have to wait
> for
> the ping command to fail due to network time-out to indicate that the
> remote
> host is not available I've gained nothing over just letting my other
> network
> access commands time-out.
>     Is there a way to execute ping wrapped in a timer - such as in a
> subprocess
> that gets killed by it's parent if it doesn't end within a practical
> time interval?
> It seems to me that that should work, but what I'm really looking for is
> someone who would share code that has already been written.

'fping' is the tool for you.
With it you can do things like:

 if fping -r1 -t100 -q $hostname ;then

where -r1 means 'try once', -t100 'timeout is 100 ms', -q 'no stdout output'

--
Peter

 
 
 

Canned "ping"

Post by Michael Wa » Tue, 19 Jan 1999 04:00:00


Quote:>    Is there a way to execute ping wrapped in a timer - such as in a
>subprocess
>that gets killed by it's parent if it doesn't end within a practical
>time interval?
>It seems to me that that should work, but what I'm really looking for is
>someone who would share code that has already been written.

I have a generic "timer" called "timeout":

usage: timeout [-t <second>] unix command with arguments

after <second> seconds, timeout kills unix command if it
has not finished. if <second>=0, timeout does not kill.

It is available from URL in my signature.
--
unix programs: niftp (non-interactive recursive ftp), hide (hide command args),
submit (replace nohup), etc from ftp://ftp.mindspring.com/users/mwang/unix-prog

 
 
 

Canned "ping"

Post by Steve Cribb » Wed, 20 Jan 1999 04:00:00


    Sounds good.  Where can I get fping?

Thanks.
/Steve
----------



> >     Within a ksh script, I would like to first determine whether or not
> > a remote
> > host is alive before I attempt other network access to it, (file reads
> > or writes).
> > The ping command seems to be the logical solution, but if I have to wait
> > for
> > the ping command to fail due to network time-out to indicate that the
> > remote
> > host is not available I've gained nothing over just letting my other
> > network
> > access commands time-out.

> >     Is there a way to execute ping wrapped in a timer - such as in a
> > subprocess
> > that gets killed by it's parent if it doesn't end within a practical
> > time interval?
> > It seems to me that that should work, but what I'm really looking for is

> > someone who would share code that has already been written.

> 'fping' is the tool for you.
> With it you can do things like:

>  if fping -r1 -t100 -q $hostname ;then

> where -r1 means 'try once', -t100 'timeout is 100 ms', -q 'no stdout output'

> --
> Peter

 
 
 

Canned "ping"

Post by Peter Smulder » Wed, 20 Jan 1999 04:00:00



>     Sounds good.  Where can I get fping?

The version I use ( fping-2.2b1 ) has references


Current maintainer and cool feature adder:


--
Peter