Hi. I have to copy between two hosts files via sftp.
I did some bash script
Code:
sftp -b /dev/fd/0 $TARGET_USER@$TARGET_HOST:$TARGET_DIR>>$FTPLOG 2>&1<<EOT
mput *.zip
chmod 666 *.zip
exit
EOT
status=$? #status of process SFTP
if [ $status -eq 0 ] # if 0 then SUCCESS
then
echo "Everything is good"
else
echo "Error while copying the files"
fi
This script look's good, but when while sftp working my network connection
could break, and sftp session hung... and script didn't work.
Help me to resolve this problem.