Hi ,
I need to write a IF condition to know if a SFTP file transfer is successful or not and send email if its failed.
`sftp username@servername <<comm1
cd /directory
put filename
comm1
bye`
I use above commands for my connections. So please help me to write a IF statement.
---------- Post updated at 04:22 PM ---------- Previous update was at 04:19 PM ----------
I tried
SFTPTEST=`sftp username@servername <<comm1
cd /directory
put filename
comm1
bye`
if [ $SFTPTest eq 0];
then
echo "SFTP Successful"
else
echo "SFTP Failed"
fi
But this didnt work...