Hi,
I have created the below ftp script to put files over to our capacity server, the check at the end works if ftp fails to run however if the script cannot login or the transfer itself failed there is no warnings.
Does anyone know the syntax to trap the erorr codes or to put a check within FTP?
Thanks a million ....
# create an ftp script to move the data to sftp
echo "ftp -v -i -n $SERV <<!EOF" > $FTP
echo "user capacity.ftp C@p@C1ty" >> $FTP
echo "binary" >> $FTP
echo "prompt" >> $FTP
# Find the processed nmon file to be sent to capacity server for processing:
cd $OUTDIR
PDATE=`perl -le '($year,$mon,$day,$hrs,$min)=(localtime(time()-$ARGV[0]))[5,4,3,2,1];printf "%04d%02d%02d_%02d\n",$year+1900,$mon+1,$day,$h
rs,$min' 3600`
TFILE=`ls ${NFILE}_${PDATE}*.csv`
if [ -f $\{OUTDIR\}/$\{TFILE\} ] ; then
continue
else
logfile "$TFILE is not available for transfer, please investigate and transfer the file."
exit 1
fi
echo "mput $TFILE" >> $FTP
echo "$DATE:$TIME//Transfering $TFILE to $SERV " >> $PROGLOG
echo "!EOF" >> $FTP
chmod 777 $FTP
#$FTP
if [ $? -ne 0 ] ; then
logfile "failed to FTP $TFILE to $SERV"
fi