I am bit new to shell scripting . I am implemented autossh between two sun solaris machines , so that when I use sftp it will not ask for the password.
Now I need to make shell script in which I have to transfer files from one server to another server automatically through root user. I try to make shell script for automatic transfer of files through sftp.
after executing this shell script I have been put to sftp> prompt. When I exit from sftp , it give me three error lcd,cd mput command not found. It does not transfer files.
Please correct my shell script. I would be greatful for that.
I know that simple scp can do the trick also. But my requirement is to do through sftp.
Problem is not as simple as you think. Actually I have to make a script in which I have to transfer 24 files of approximately 4 to 5 mb each (text based). My shell script should check the number of bytes of each files at server one then after transfer of all these files to server two it should check that all files have been transfer and also have the same number of bytes as in server one.
When I execute the xyz file it gives me the files which are transfer & log into output file. -B used for fast transfer of files. If I don't give the -v option even then it work. But when I use -v option, kindly tell me where and in which file sftp do the loging.
One more thing is that output file only show the output when all the files are transfer. But suppose when I dissconnected the network during the transfe of files then it will not show any output. I need a solution in which if something happen during transfer of files then either sftp start sending all the files again or from where it was left.
Even without "-v" option the sftp works. But "-v" option gives the details of sftp connection and what exactly it is doing.
When you changed the code, you have grep'ed the 1st file (sftp1.log) instead of 2nd file (sftp2.log).
sftp1.log gives you the details of the command that is executed from the batch file but sftp2.log gives you the details of the connection such as servername, port, authentication of key, bytes per second and transfer status.
I have been searching for this i am also facing the same problem and your script worked. Any reason why put and get commands does not work in the shall script why do we need to pass the another batch file for the commands.