Simon:
rsh -l<login-name> <router-ip> sh ver
"rsh -l login ip" on its own should get you a login shell. rcp is the usual way to copy files across, but "cat srcfile | rsh -l login ip 'sh cat
destfile'" should work if you have to. Hope that helps.
On Fri, 14 Dec 2001 12:11:24 MJ Ray wrote:
Simon:
rsh -l<login-name> <router-ip> sh ver
"rsh -l login ip" on its own should get you a login shell. rcp is the usual way to copy files across, but "cat srcfile | rsh -l login ip 'sh cat
destfile'" should work if you have to. Hope that helps.
-- MJR
Simon, was this what you were asking or are the contents of the file you talk of actually commands that the router should execute rather than data to be stored on the router?
If the file contains commands for the router to execute then all you need is:
rsh -l<login-name> <router-ip> < filename
Steve.
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?
Simon
"It's hard to be fit as a fiddle when you're shaped like a cello"
-----Original Message----- From: main-admin@lists.alug.org.uk [mailto:main-admin@lists.alug.org.uk]On Behalf Of Steve Fosdick Sent: 15 December 2001 17:56 To: MJ Ray Cc: Simon; ALUG Subject: Re: [Alug] redirecting into a command...
On Fri, 14 Dec 2001 12:11:24 MJ Ray wrote:
Simon:
rsh -l<login-name> <router-ip> sh ver
"rsh -l login ip" on its own should get you a login shell. rcp is the usual way to copy files across, but "cat srcfile | rsh -l login ip 'sh cat
destfile'" should work if you have to. Hope that helps.
-- MJR
Simon, was this what you were asking or are the contents of the file you talk of actually commands that the router should execute rather than data to be stored on the router?
If the file contains commands for the router to execute then all you need is:
rsh -l<login-name> <router-ip> < filename
Steve.
main@lists.alug.org.uk http://www.anglian.lug.org.uk/ http://lists.alug.org.uk/mailman/listinfo/main Unsubscribe? See message headers or the web site above!
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.