Hi,
I have an SFTP script which is called from another run script:
When the SFTP process is run we passed through an invalid ip address to check the error logging and to ensure everything is working as expected.
Below is a sample of the code in the script:
$RUNSOCKS /usr/local/bin/sftp -v -B /dev/fd/0 ${IP_ADDRESS} 2>&1 <<EOF
lcd ${LOCAL_DIR}
cd ${REMOTE_DIR}
mput ${FILES}
ls -l
quit
EOF
FTP_ERROR=$?
The result fo the SFTP script is as follows:
warning: Connecting to nn.nnn.nnn.nnn failed: Connection Refused
+ FTP_ERROR=0
Zero is not good. This means in return to my parent script I continue processing as normal as it believes nothing is wrong.
Does anyone know how I ensure that an error is returned to the parent script when an invalid IP address is supplied so that I can handle it correctly.
Thanks
Ron