My Original Post was:
> Subject: How to find out if machine is up remotely
> Hi managers,
> I update my printer files using rdist. We have variety of architectures
> and operating systems. My rdist always hangs and never finishes. I want to
make sure that machine is up and can do my rdist before I actually
> start the rdist. I don't want to use ping as it doesn't guarantee that
> my rdist will run for sure. Any better suggestions?? I would appreciate
> the reason for the suggestions. I will summarize.
> Manish Doshi
One of the solution is to get new versin of rdist but that will require
me to compile is for every architecture that we have and every operating
system we have. So I will have to use a wrap around script like
rup or rsh with a timeout and then move on.
Thanks to everybody who replied.
Following were the replies:
Sender: Trevor Paquette <TrevorPaquette@aec.ca>
From: "Trevor Paquette" <TrevorPaquette@aec.ca>
Do a telnet to the daytime port. IF you get back the string
"Connection timed out" then the machine really isn't up..
telnet davinci daytime << EOF >& t.out
grep "Connection timed out" t.out >& /dev/null
if ( $status = 0 ) then
machine is up
machine is down
From: Stephen Potter <email@example.com>
Check the 'echo' port. That should make sure the machine is in a usable
state as it is run from inetd.
From: firstname.lastname@example.org (Umesh Vaghela)
You can use ping to find out if the machine is up or not. Ping returns
an exit status of 0 if it is up or else 1 if it fails for some reason.
I hope this helps.
From: Herbert Wengatz <email@example.com>
How about an:
"rsh HOSTNAME uname -n" ?
This makes a remote login, executes a program, and delivers the hostname
back. - So you can be sure, that the program was actually running on the
machine you want to reach. You can login and execute programs...
What do you want more ?
Use a series of the r* commands.
ie: rcp (remote cp)
ruptime (uptime executed on another machine)
rusers (list of users on remote machine.)
From: Anchi Zhang <anchi@Starbase.NeoSoft.COM>
You could do
if rup remote_host
rdist -c something remote_host
Though rup does not give you 100% guarantee, it is much better than
You could use "rsh remote_host date" but your rsh may hang too. A
sure solution is to have a timed rsh using perl or something but perl
adds a lot of overhead and thus not pratical if you have to reach many
From: Bob Fulwiler <firstname.lastname@example.org>
See if you can execute a simple rsh on the target machine. If it returns
ok, then you know that things should work.
From: scott hollatz <email@example.com>
If I remember correctly, there is a program named 'fping' that will use TCP
packets instead of ICMP packets to ping the host. This will at least tell
you if the operating system is running.
From: firstname.lastname@example.org (Jochen Bern)
This will have Side Effects, but you could replace rsh/rlogin/rcp
with ssh altogether (good_Thing (tm) for various Reasons, encrypted
Connection, Host Verification, automated DISPLAY Magic, to name a few)
and then configure it not to fall back to the original rsh (if the ssh
Connection fails) for local Connections. As far as I've observed it so
far, attempted ssh Connections time out pretty fast (several Seconds).
From: email@example.com (Karlheinz Pischke)
I have interactively tested in a csh environment:
mybox.kpischke.266% rsh machineX -n "ls > /dev/null"
mybox.kpischke.267% echo $status
mybox.kpischke.268% rsh machineOK -n "ls > /dev/null"
mybox.kpischke.269% echo $status
You see that the status returned by rsh gives you the decision you need.
In generel "rdist" depends as well as "rsh" on ~/.rhost or /etc/hosts.equiv
So you can use rsh" for the test !
You may take a more "genious" command instead of -n "ls > /dev/null"
-- "You can not discover new oceans unless you have the courage to lose sight of the shore" - Anonymous
"There is nothing more constant than change" - Anonymous
Manish Doshi, .............. ___ _/| .. __ __ .. ___ _/| ........... Dept. of Computer Science \ x x ' / o O \ \ o O University of Houston ( ^ ) ( ^ ) ( ^ ) Houston, TX 77004 ............. U ........ U ........ ~ ...............
Email :- firstname.lastname@example.org Work:(408)285-6561 Home:(415)967-3445 URL: http://www.bchs.uh.edu/~mdoshi
This archive was generated by hypermail 2.1.2 : Fri Sep 28 2001 - 23:11:10 CDT