Re: Ftp script condition code 0

From: Adams Kevin J (kevin.adams@PHS.COM)
Date: Wed Feb 12 2003 - 17:58:45 EST


It may be beyond what you want to do just to get a condition code, but the
"expect" language is ideal for your situation.

Like Paul said, you could just save stdout to a file and parse it.

Kevin Adams

-----Original Message-----
From: Paul LaMadeleine [mailto:plamadeleine@LIGHTBRIDGE.COM]
Sent: Wednesday, February 12, 2003 2:06 PM
To: aix-l@Princeton.EDU
Subject: Re: [aix-l] Ftp script condition code 0

Unless the ftp binary dies in some horrible way (say a core dump or
something), then it will always exit with a 0. Just because the data
transfer failed does not mean ftp did not run correctly. As an example, say
you telnet somewhere, type in exec ls xyz123, and the ls fails, the status
of the telnet would still be 0.

In order to check if the command you want ftp to process happened, you'll
need to do some extra processing, either of parsing of output or something.

        Hope this helps.

        Paul

At 12:17 PM 2/12/2003 -0800, you wrote:

When I run ftp scripts I check for the condition code;
but I have found , that when the ftp fails -
say I don't connect - the condition code from the ftp
is always condition code zero.

Why does this occur ? Is there a circumvention to this issue ?

Here is a sample ( simplified ) script :

ftp -i -v clients.dns.name < my_ftp_parms

if [ $? != 0 ]
     then
     echo "myclient zip ftp error" >> /my/ftp5950/oztcmo.log
     mail -s "UNZIP ERRORS" sgly0@ucop.ais.ucla.edu
<mailto:sgly0@ucop.ais.ucla.edu> < /my/ftp5950/oztcmo.log
     exit 0
fi

John Yard
UCLA Administrative Information Systems
Distributed Platforms
Unix/Win2000 Admin/Sybase/Oracle/SqlSrvr/Networking
310-825-1725

This electronic message transmission, including any attachments, contains information from PacifiCare Health Systems Inc. which may be confidential or privileged. The information is intended to be for the use of the individual or entity named above. If you are not the intended recipient, be aware that any disclosure, copying, distribution or use of the contents of this information is prohibited.

If you have received this electronic transmission in error, please notify the sender immediately by a "reply to sender only" message and destroy all electronic and hard copies of the communication, including attachments.



This archive was generated by hypermail 2.1.7 : Wed Apr 09 2008 - 22:16:35 EDT