On Sun, 16 Dec 2001 09:08:13 Simon wrote:
Hi Steve, The file contains the command currently, I've tried "rsh -l<login-name> <router-ip> < filename" but just get a timeout error. I know the connection work ok as a "rsh -l<login-name> <router-ip> sh ver" works.. Will I get a timeout of there is a problem with the commands?
When the other end of an rsh connection is another unix box, omitting the command argument (as in my example above ) will normally cause the other end to start a copy of the shell and that shell will read commands from the network connection that rsh has set up, so if you have rsh's standard input redirected to come from a file I would expect the commands in that file to be fed over the network and executed by the shell.
One thing to check is that it isn't getting stuck because it is prompting you for a password and then doesn't read a correct password from your input file. It also looks as if the box at the other end in your cases is a CISCO router so perhaps the behave a little differently.
There are several more things you could try:
1. If the router has a command to start another copy of it's command interpreter (just like you can type 'sh' or 'bash' etc on Linux/Unix) then you could give that command on the rsh command line and see if that works.
2. If the router has the ability to do input redirection from a file then you could transfer the file in one rsh session, maybe using rcp or Mark's earlier suggestion and then use a second rsh session to 'run' the file at the other end.
3. If all else fails you could handle the file locally on the unix box and use a separate rsh session for each command. This is less efficient but it should work - here's an example:
while read command do rsh -l <login-name> <router-ip> "$command" done < filename
Hope this helps, Steve.