I'm new to SSH sessions. My aim is to connect to remote unix server and execute my scripts over there. I'm using SSH sessions(secure-inet factory API) to achieve this. The (unix)script I put on server, just copies a file (the file name I'm passing from java code) from one location to another location on the server.
I'm able to connect & my code is working fine for small files say < 100 MB. When file size is more than that, I'm getting "Exceeds Task Time-out of 120000s waiting for end prompt" error & I'm not able to proceed further.
Any help would really be appreciated.
Thanks in advance.
Thank you for your response. Yes, I've gone through the API. I tried all the possible methods in there. Below are what I tried...
session.send(cmd); // normal scenario
session.sendWait(cmd,"$",<time in millisec>);
where cmd = "./<my script>"
1. When I use the first method, I'm able to copy max. 40MB
2. When I use the second method, I'm able to copy max. 500MB. Here the error message would be those many ms I specify in sendWait() method.
But, in my case, I would not be able to know, what the file volume is & this method needs to be executed in a loop. So, I wanted the session to last long enough to make sure all the files copied successfully.
Is there any particular reason you want to wait? I see there's a sendNoWait method. I take it that this one is a "fire and forget" type call, may be like nohup-ing the command. You might use this one, then have your script include updating a status of some kind that you can periodically check.
santosh batta wrote:2. When I use the second method, I'm able to copy max. 500MB. Here the error message would be those many ms I specify in sendWait() method.
Then why not set the time based on the amount of data that needs to be copied? I'm sure you can come up with some reasonable overestimate.
However, I'm very surprised you get the same error with sendNoWait(). That would suggest that there's some upper limit on how long a command is allowed to execute for, which seems kind of arbitrary.
I guess my question would be: why do you need to copy more than 500Mb? That would suggest a design issue to me.
"Leadership is nature's way of removing morons from the productive flow" - Dogbert
Articles by Winston can be found here
posted 6 years ago
Thanks for the look. As I mentioned earlier, I would not know anything about the server files like the size,format and no. of files on the server location etc. I'm actually designing a tool, to serve my purpose of manual copy of files on unix box. I want to do it from this tool to copy files from the java code. I really can't comment on the design level issues. Could you please tell me what exactly is causing the error in question? probably I can workout based on that. Thanks a lot for your insight.