I copied the information from this thread to reconstruct my ftp script; however I am not getting any emails when the 550 error occurs. I checked sendmail and it's working fine:
ftplog=$HOME/log/preprocess.$$
ftp -nv $FTP_HOST<<END_SCRIPT>>$ftplog
quote USER $FTP_USER
quote PASS $FTP_PASSWD
lcd $TEMPDIR
cd $REMOTE_DIR
binary
rename $BNAME $newfname
get $newfname
dir
sleep 5
delete $newfname
quit
END_SCRIPT
xfrcnt1=`grep "^550 " $ftplog | wc -l`
xfrcnt2=`grep "^5[0-9][0-9] " $ftplog | wc -l`
if [[ $xfrcnt1 -ne 0 ]];then
echo "ftp 550 error $MBOX $BNAME" | mailx -s "ftp 550 error $MBOX $BNAME" myemailaddress
elif [[ $xfrcnt2 -ne 0 ]];then
echo "ftp 5xx error $MBOX $BNAME" | mailx -s "ftp 5xx error $MBOX $BNAME" myemailaddress
else
echo "success"
fi
If someone could take a look, i'd really appreciate it, thanks
ftplog=$HOME/log/preprocess.$$
ftp -nv $FTP_HOST<<END_SCRIPT>>$ftplog
quote USER $FTP_USER
quote PASS $FTP_PASSWD
lcd $TEMPDIR
cd $REMOTE_DIR
binary
rename $BNAME $newfname
get $newfname
dir
sleep 5
delete $newfname
quit
END_SCRIPT
xfrcnt1=`grep "^550 " $ftplog | wc -l`
xfrcnt2=`grep "^5[0-9][0-9] " $ftplog | wc -l`
if [[ $xfrcnt1 -ne 0 ]];then
echo "ftp 550 error $MBOX $BNAME" | mailx -s "ftp 550 error $MBOX $BNAME" myemailaddress
elif [[ $xfrcnt2 -ne 0 ]];then
echo "ftp 5xx error $MBOX $BNAME" | mailx -s "ftp 5xx error $MBOX $BNAME" myemailaddress
else
echo "success"
fi
If someone could take a look, i'd really appreciate it, thanks