vinhnguyen18
Technical User
Hi,
What I'm trying to do:
Manually from bash shell, if I execute this command:
ssh $ip -l $username -s netconf < 500M_file
This redirects entire content of 500M_file to my ssh channel. The server listening on this channel, will get the content, do some stuff and return some string.
When automating this using "spawn ssh...", things are working fine, and I can use "expect 'Password:'" to enter password. However this method this not work well for me because once in "spawn ssh..." I will have to open the 500M_file, read it, then do "send...". Since the file is so huge, it hogs up all my memory.
Therefor, I'm thinking of just using "system" command as follows:
system "ssh $ip -l $username -s netconf < 500M_file"
But when doing this command, I get a prompt for password. Eventhough I do a "send 'password\r'", it just does not responds and hangs there. I'm guessing that I'm not sending to the correct I/O.
I would appreciate any advise/help with this.
What I'm trying to do:
Manually from bash shell, if I execute this command:
ssh $ip -l $username -s netconf < 500M_file
This redirects entire content of 500M_file to my ssh channel. The server listening on this channel, will get the content, do some stuff and return some string.
When automating this using "spawn ssh...", things are working fine, and I can use "expect 'Password:'" to enter password. However this method this not work well for me because once in "spawn ssh..." I will have to open the 500M_file, read it, then do "send...". Since the file is so huge, it hogs up all my memory.
Therefor, I'm thinking of just using "system" command as follows:
system "ssh $ip -l $username -s netconf < 500M_file"
But when doing this command, I get a prompt for password. Eventhough I do a "send 'password\r'", it just does not responds and hangs there. I'm guessing that I'm not sending to the correct I/O.
I would appreciate any advise/help with this.