[SunHELP] How to trap ftp error codes

Patrick Marquetecken patrick.marquetecken at pandora.be
Thu Jul 24 12:38:16 CDT 2003


On Thu, 24 Jul 2003 13:31:38 -0400
Naser Ali <Ali.Naser at irs.gov> wrote:

> Hello,
> 
> I am trying to trap ftp return code or error code to make my automated ftp
> script more  robust. Is there a way to accomplish this.
> 
> Any pointers will be great help.
> 
> TIA 
> 

This is what i uses, could beter, but it works fine

RESULT=`ftp -n -v << erin | grep -c "Transfer complete"
open $REMOTEHOST
user xxx yyyy
bin
lcd "$LOCALDIR"
cd "$REMOTEDIR"
put "$BESTAND"
bye
erin`

if [[ $RESULT -lt 1 ]]; then
	echo "$BESTAND\tNO\t`date`" >> $LOGFILE
	# functie voor het verplaatsen naar FTPspool dir 
	if [[ -a $ERRORDIR/$BESTAND ]]; then
	  /usr/local/es/dt mv $ERRORDIR/$BESTAND ../$BESTAND
	fi  
else
	echo "$BESTAND\tOK\t`date`" >> $LOGFILE
fi

Patrick

-- 
  "If we don't get more power to the warp drive we're all going to have to get out and push!" -- Paris (Parallax)

 PGP Key: http://users.pandora.be/rivendell/marquetp.gpg
 Fingerprint = 2792 057F C445 9486 F932 3AEA D3A3 1B0C 1059 273B
 ICQ# 316932703 
 Registered Linux User #44550
 http://counter.li.org

[demime 1.01b removed an attachment of type application/pgp-signature]



More information about the SunHELP mailing list