1826373 Members
4251 Online
109692 Solutions
New Discussion

rsh time_out

 
SOLVED
Go to solution
Giuliano
Occasional Advisor

rsh time_out

how to know the rsh timeout(ms)?
I use a crontab command with rsh and sometimes it failes for time out reason.
I noticed that sometimes ping responces are slow (200 ms) but i don't know if ping replying time is related to rsh timeout.
Thanks
system admin
12 REPLIES 12
Ramkumar Devanathan
Honored Contributor

Re: rsh time_out

Hi Guilano,

If you mean rsh as in 'restricted shell' and timeout as in 'timeout' ;-)), then here's a link which gives some details.

http://www.geocities.com/~gregl/htm/bourne_shell_tutorial.htm

Let me know if i am way off the mark.

The page says that TIMEOUT is an environment variable.

FWIW.

- ramd.
HPE Software Rocks!
Giuliano
Occasional Advisor

Re: rsh time_out

you are rigth but TIMEOUT variable is unset into the sh enviroment, wich is the value of the TIMEOUT in this case?
system admin
Ramkumar Devanathan
Honored Contributor

Re: rsh time_out

Hi Guilano,

You should probably be looking at /etc/inetd.conf file for this value - this may be the default value which exists for any other shell sessions too - see the 'shell' entry for any -t specification. I don't have rsh installed on my hp-ux machine - so i am merely guessing...

see man inetd.conf on how to set timeouts for shells.

Let me also search a while, and get back to you if i find anything that you'd find useful.

- ramd.
HPE Software Rocks!
Giuliano
Occasional Advisor

Re: rsh time_out

....just now i noticed that i wrote "rsh" but it is wrong: "rmsh" is right.
Sorry!
system admin
Ramkumar Devanathan
Honored Contributor

Re: rsh time_out

what's rmsh - if this is remsh (remote shell) - my earlier post still holds good...

- ramd.
HPE Software Rocks!
Bill Hassell
Honored Contributor

Re: rsh time_out

remsh (the remote shell command interface) is typically used to run a remote command so there is no real login shell. So the value of TMOUT (the POSIX and ksh timeout value) has no meaning. It only has meaning when the shell is idle, waiting for keyboard input. For instance:

remsh some_cpu sleep 20

will have the following hierarchy:

inetd -> remshd -> sh -c sleep 20 -> sleep 20

So, when sleep 20 finishes, the sh -c program resumes, but there is nothing to do so it exits. Since you are running a cron job, you must examine exactly what the commands are doing and repair any commands that can hang. This is especially true if your cron job performs an su - some-login. The reason is that login profiles are often incorrectly written for batch jobs and need to protect any interactive terminal commands.

When the cron job hangs, you need to investigate what portion is causing the hang. If it is the command itself, fix the command (often networking commands including NFS-related tasks will hang), or rewrite the cron job to monitor the command in the background and kill the job when it fails to return in a certain length of time.

If it is the shell itself, then remsh is not being utilized correctly (ie, the shell is waiting for some keyboard input). You'll need to setup logging to determine the reason for the pause.


Bill Hassell, sysadmin
Giuliano
Occasional Advisor

Re: rsh time_out

remsh -n "ps -ef......." is the command line in my script in crontab.
The standard output return "Connection timed out".
Does mean that the remote host is not available or wich?
In my inetd.conf there is next string:
"shell stream tcp nowait root /usr/lbin/remshd remshd".
there isn't any value related to remshd timeout.
thanks in advance

system admin
Bill Hassell
Honored Contributor
Solution

Re: rsh time_out

Correct, remshd has no timeout value per se. There is a keep-alive option which is turned on by default. However, this only terminates the session if the remote host crashes or becomes unreachable over the network. You don't want a global timeout since some commands do indeed take a long time.

As far as ps -ef, this is likely a remote host problem. If you are looking for a specific process, using ps|grep is a bad way to do things. Let ps do the looking for you:

Look for a specific user ID:

ps -f -u some-user

Look for a specific process:

UNIX95= ps -f -C process-name

Doing a global ps can sometimes hang even for a local conection and ps may have problems getting sane information over the network because the network is slow and processes can change rapidly every second.

Post your script and perhaps we can find a more reliable way to accomplish your tasks.


Bill Hassell, sysadmin
Giuliano
Occasional Advisor

Re: rsh time_out

OK, where is keep-alive option? Can I set his value in ms? I hope remote host has a tcp problem because if i ask for rlogin command, sometime answers before many seconds.
system admin
Giuliano
Occasional Advisor

Re: rsh time_out

....no before.....after
system admin
Bill Hassell
Honored Contributor

Re: rsh time_out

You can only turn off the keep alive option (man remshd, it's the -n option). Now the delays you are experiencing at login are very likely due to DNS. remsh (and rlogin and rcp) attempt to do a little bit of verification by looking up the incoming hostname both directions. If resolv.conf on the remote system is pointing first to a dead DNS server, there will be a 10-20 sec timeout.


Bill Hassell, sysadmin
Giuliano
Occasional Advisor

Re: rsh time_out

thanks for all; i applied ARPA patchs to increase network performances.
system admin