Operating System - HP-UX
1832608 Members
2109 Online
110043 Solutions
New Discussion

PING without waiting for unreachable nodes

 
SOLVED
Go to solution
Enrico Venturi
Super Advisor

PING without waiting for unreachable nodes

Hello colleagues,
I want to check if a node is reachable;
we cannot use any other service but the "/etc/ping" because most of the services are unavailable (i.e. no telnet is allowed, .... ).

Is the "ping" able to check the reachability of the nodes with a fixed minimum timeout (e.g. 1 sec) in all the cases??
We use an algorithm so we don't want to wait too much when waiting for the node check.

regards
Enrico
5 REPLIES 5
RAC_1
Honored Contributor
Solution

Re: PING without waiting for unreachable nodes

Check -m option for ping. But the default is 10 sec.

Anil
There is no substitute to HARDWORK
Steven E. Protter
Exalted Contributor

Re: PING without waiting for unreachable nodes

hostname=someserver.your.net
ping $hostname -n 1 -m 1
rc=$?

if [ $rc -eq 0 ]
then
echo "$hostname reached successfully..."
else
echo "$hostname not reached...."
fi

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Victor BERRIDGE
Honored Contributor

Re: PING without waiting for unreachable nodes

Hi Enrico,
If I believe my BB config I would say no, that is BigBrother reports sometimes hosts:
[2221012] street.conn red Mon Jun 14 11:09:38 MET DST 2004 bb-network.sh: Can't ping street...

But If you ping the host you see its alive, that means BB pings once and if no reply it considers as not responding...

So I would say be causious on the fixed minimum ( not 1 sec...)


All the best
Victor
BONNAFOUS Jean Marc
Trusted Contributor

Re: PING without waiting for unreachable nodes

Hi,

Use -c and -w options:

ping -c -w

example: ping -c 1 -w 1 servername, ping one request to servername and wait for a reply during one second maximum.

NB: -w option works only with -c options

Rgds
JMB
Si vous ne faites jamais de bétises, c'est que vous ne faites rien de difficile. Et ça c'est une grosse bétise.
Cole L.
Advisor

Re: PING without waiting for unreachable nodes

You may want to try fping. It is a utility that is designed to ping multiple hosts almost at the same time. It is very script friendly. Check out www.fping.com