Rsh stops working after a few hundred calls


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Rsh stops working after a few hundred calls
# 1  
Old 08-23-2013
Rsh stops working after a few hundred calls

There's probably a better way to do what I'm doing and if so, let me know an alternative.

I have a script that runs rsh for every entry in a txt file to go get the file size off the remote server. I then compare the remote size with a local size.

My script worked fine until recently when I was comparing a large list (600+). After about 400 files, the rsh command returned nothing.

My repeated command would be similar to:
Code:
rsh server1 dir /u2/web/a.jsp 2> /dev/null |awk '{print " ",$5," ",$9}'|tr -s " "

/u2/web/a.jsp would be one of the 600 files I'm getting the size of.

I'm able to continue making it work by putting in a 2 second sleep every 10th file.

Any thoughts as to why and/or possibly any alternatives?

Thank you for your time.

Moderator's Comments:
Mod Comment Use code tags please, see PM.

Last edited by zaxxon; 08-23-2013 at 11:31 AM.. Reason: code tags
# 2  
Old 08-23-2013
First off, UNIX doesn't have dir, it's probably just an alias to ls -l.

Why not list more than one file at once, to reduce the number of rsh calls?

You could also use a tool like rsync to compare and synchronize remote folders with each other.
# 3  
Old 08-23-2013
The system might run out of sockets.
Place a sleep 1 between the rsh calls!
Bundle commands to one host
Code:
rsh host '
command1
command2
'

--
Just seen your confirmation.
A closed TCP connection stays a while in TIMEWAIT (can be seen with netstat) in the hope of a re-open. But a rsh process cannot re-open the connections of the previous rsh commands. If rsh are fired too rapidly the system runs out of sockets.

Last edited by MadeInGermany; 08-23-2013 at 02:26 PM..
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

My script stops working when using crontab

I have made a shell script(/bin/sh) that starts a perl script (that I haven't made my self) that's starts a ssh session. The ssh session uses a private/public key to login so no password is needed. The Perl script works perfect. But when I put it in a cronjob (crontab) the ssh connection asks... (6 Replies)
Discussion started by: splinter_cell
6 Replies

2. Shell Programming and Scripting

Script stops working after copying it

Hi all, When I cp a script, this section of the code stops reading from a file. if ; then while read dirtoclean do DIRSTOCLEAN=${DIRSTOCLEAN}' '$dirtoclean done < ${BASEDIR}test.conf fi ${DIRSTOCLEAN} doesn't return anything, even though it will work right before... (6 Replies)
Discussion started by: nicksantos1
6 Replies

3. Solaris

rsh is not working

i am using solaris 8. i can access my server through telnet. but not able to access rsh or rlogin. i can rsh from this server to another machine but not from other machine to this machine. How to start rsh service. i have restarted inetd. pkill -HUP inetd. thanks (1 Reply)
Discussion started by: sunnybee
1 Replies

4. SuSE

USB mouse stops working

I have 64bit 11.1 installed on a clone. The Logitech LX3 mouse stops working sometimes, forcing a reboot. The LED under the mouse goes dark when this happens. A normal ps/2 mouse works fine, and I am certain the LX3 mouse is not defective as I have an identical one on a XP system that I swapped to... (6 Replies)
Discussion started by: stansaraczewski
6 Replies

5. UNIX for Advanced & Expert Users

ssh-keygen stops working

Hey guys, I was using ssh-keygen settings for a long time to login on remote machines without password. 2 days back it suddenly stops working, i tried by reset all ssh-keygen setting but it not works. what could be the reason of this issue and how can i resolve this? (2 Replies)
Discussion started by: RohitKJ
2 Replies

6. AIX

rsh not working

Hi, I am getting the below error while using rsh from other logins in AIX 5.3 rcmd2: socket: The file access permissions do not allow the specified action. whereas the same is working fine with root login. I have already defined the host entries in etc/hosts as well as in .rhosts... (0 Replies)
Discussion started by: viplov
0 Replies

7. Solaris

Solaris 10 - init stops working

I have a really strange issue on Solaris 10 running on v490. I'm running Oracle 10g on the box. Everything runs fine and all of a sudden I get a call from a DBA. I check and none of the Oracle processes are running. They were definitely running after the system booted and nobody stopped them. I try... (0 Replies)
Discussion started by: GKnight
0 Replies

8. AIX

RSH not working

Hi all I have updated my .rhosts file as per the norm, however for some reason on hostA I cannot rsh to hostB. The entries on /.rhosts on hostA are as follows :- hostB + hostB on the other can do rsh without a problem. Any ideas ? :confused: (1 Reply)
Discussion started by: jhansrod
1 Replies

9. Shell Programming and Scripting

Multiple rsh in a script not working

Hi, From one of the unix servers i want execute an rsh command to 5 different servers. i want to go to these servers execute a command and come back. i have a main program which calls a function, where in i use the rsh command. The server name is passed as a parameter to teh function. it is... (3 Replies)
Discussion started by: praphul
3 Replies

10. UNIX for Dummies Questions & Answers

rsh not working

Dear all; I have to Unix servers SUM1 and SUM2 running Reliant Unix 5.45 on both servers i have a system user called "netop". i want netop on SUM1 to execute rsh from SUM1 to SUM2. What i did, i put in the .rhosts file in the home directory of netop on SUM2 the following entry: netop ... (2 Replies)
Discussion started by: bcheaib
2 Replies
Login or Register to Ask a Question