[comp.protocols.tcp-ip] quick check for available host

jim@tiamat.fsc.com (Jim O'Connor) (09/28/90)

What is a quick way for a shell script to find out if a networked
host is currently available?

For instance, I'd like to do something like

if host_present hostname
then
	# run network commands
else
	# take other action
fi

Using just about rsh (or rcmd, or remsh, depending on your flavor)
command will work, but it takes rsh (mine anyway) over a minute to
time out, and I'd like to use something that works a little quicker.

I have a socket library, so if you just have programming tips, send them
along and I'll try to write a program that does just what I want.

Thanks,
--jim
------------- 
James B. O'Connor			jim@tiamat.fsc.com
Ahlstrom Filtration, Inc.		615/821-4022 x. 651

lih@cbnewsk.att.com (andrew.a.lih) (10/04/90)

In article <771@tiamat.fsc.com>, jim@tiamat.fsc.com (Jim O'Connor) writes:
> What is a quick way for a shell script to find out if a networked
> host is currently available?

If you just want to know if the host is alive, then the 'ping'
program will suffice.  It basically sends packets over to the
host you specify and returns the round trip time for the
packet.  Most of the time it is used to detect delays and
transmission times, but in this case you can use it to see
if the machine is up.

/lih

AT&T Bell Labs
Middletown, NJ

peiffer@cs.umn.edu (Tim Peiffer (The Net Guy)) (10/06/90)

In article <1990Oct3.200749.16049@cbnewsk.att.com> lih@cbnewsk.att.com (andrew.a.lih) writes:
>In article <771@tiamat.fsc.com>, jim@tiamat.fsc.com (Jim O'Connor) writes:
>> What is a quick way for a shell script to find out if a networked
>> host is currently available?

	If you want more than what 'ping' offers, but not the mess
	that rwho provides, check out rup(), and rusers().

Tim
-- 
-----------
Tim Peiffer				peiffer@cs.umn.edu 	or
Computer Science Dept			..!rutgers!umn-cs!peiffer
University of Minnesota