Operating System - HP-UX
1753841 Members
8331 Online
108806 Solutions
New Discussion

Re: Check return code via FTP

 
Dave La Mar
Honored Contributor

Re: Check return code via FTP

O.K. Samuel one last note on one of the method we use.

The destination knows when the file is complete when we send a "marker file". In one case the ftp jobs consists of sending up to 100 files. We cut out the file names sent from the log and send it as a recap.txt that they use as notification all is complete. Another job uses the byte count from the log file sent in another type of "marker file".
As stated, there are legions of errors that may be detected and legions of ways to let the destination know the ftp is completed. Some people send the ftp as one file name, then perform another ftp to rename the file when complete.

It's all a matter of what works for you and what your people are comfortable with. There is no real "best way". It is totally dependent on your environment, skill sets, and the users involved.

Again, best of luck.

dl
"I'm not dumb. I just have a command of thoroughly useless information."
Jos de Ruiter
Advisor

Re: Check return code via FTP

Hi Samuel,

Try this one:

export TMPLOG=/home/enz./.mixzftplog
export TRANSFER=/home/enz./.transfer.log

FTP=/home/operator/backup/ftpmixz.cmd
echo "user user passwd">$FTP
echo "lcd /home/enz.">>$FTP
echo "bin\nprompt\nmput filenaam">>$FTP
echo "quit">>$FTP
#
echo "\nBegin enz. " `date '+%d %b %Y %X` >>$TMPLOG
ftp -n -v ipnummer <$FTP 2>$TRANSFER 1>&2
cat $TRANSFER|grep "Transfer complete" >/dev/null
ERRORLEVEL_TRANSFER="$?"
if [ $ERRORLEVEL_TRANSFER -ne 0 ]; then
echo "\nTransfer FAILED: user probleem, connection probleem, enz " `date '+%d %b %Y %X` >>$TMPLOG
else
echo "\nTransfer complete " `date '+%d %b %Y %X` >>$TMPLOG
fi
Jos de Ruiter