How to check for a sucecssful FTP file transfer???

How to check for a sucecssful FTP file transfer???

am 09.10.2007 10:36:39 von Sandy80

Hi everybody,

I have a shell script that calls FTP to transfer a file from one
server to another server. Depending upon whether the file has been
ftped successfully or not the script executes the next step. I am
using "$? = 0" to check fo the file transfer status but the FTP always
returns $?=0.
How do I check for successful completion of a file transfer in FTP?
Please give me the specific command,

Thanks,
Sandy.

Re: How to check for a sucecssful FTP file transfer???

am 09.10.2007 16:21:03 von Bill Marcum

On 2007-10-09, Sandy80 wrote:
> Hi everybody,
>
> I have a shell script that calls FTP to transfer a file from one
> server to another server. Depending upon whether the file has been
> ftped successfully or not the script executes the next step. I am
> using "$? = 0" to check fo the file transfer status but the FTP always
> returns $?=0.
> How do I check for successful completion of a file transfer in FTP?
> Please give me the specific command,
>
> Thanks,
> Sandy.
>
Grep the output of the ftp command, or have a second file containing the
md5sum of the file to be transferred.

Re: How to check for a sucecssful FTP file transfer???

am 11.10.2007 12:56:18 von bonomi

In article <1191918999.765557.48320@19g2000hsx.googlegroups.com>,
Sandy80 wrote:
>Hi everybody,
>
>I have a shell script that calls FTP to transfer a file from one
>server to another server. Depending upon whether the file has been
>ftped successfully or not the script executes the next step. I am
>using "$? = 0" to check fo the file transfer status but the FTP always
>returns $?=0.
>How do I check for successful completion of a file transfer in FTP?

outside the FTP program, you -don't-.

>Please give me the specific command,

You need a -smart- program that understands the FTP protool, _and_ an
indicate success/failure back to the invoking environment.
*OR* do everything inside the scripting language of a program that knows
how to do FTP transfers.

"KERMIT" is good for the latter approach to your problem.

lastly, you -might- be able to use 'expect' to driver the FTP program,
rather than a here-document in your script. With eough effort you can
probably get 'expect' to figure out when a transfer failed. (easiest to
*assume* it failed, and treat the 'transfer completed' message as the
special condition that must be handled differently.

Re: How to check for a sucecssful FTP file transfer???

am 11.10.2007 16:57:13 von unknown

Post removed (X-No-Archive: yes)

Re: How to check for a sucecssful FTP file transfer???

am 15.10.2007 07:48:49 von gerg

Michael Vilain writes:
>In article <13gs0aio4f4mh6d@corp.supernews.com>,
> bonomi@host122.r-bonomi.com (Robert Bonomi) wrote:
>
>> "KERMIT" is good for the latter approach to your problem.
>>
>> lastly, you -might- be able to use 'expect' to driver the FTP program,
>> rather than a here-document in your script. With eough effort you can
>> probably get 'expect' to figure out when a transfer failed. (easiest to
>> *assume* it failed, and treat the 'transfer completed' message as the
>> special condition that must be handled differently.
>
>You may be better off using something like perl with CPAN modules which
>can ftp (libnet has an ftp module or you could grep the CPAN library).
>

All these suggestions can work, but they take a lot of effort
to reinvent poorly what UUCP has done well for many years now.

-Greg
--
::::::::::::: Greg Andrews ::::: gerg@panix.com :::::::::::::
I have a map of the United States that's actual size.
-- Steven Wright

Re: How to check for a successful FTP file transfer???

am 16.10.2007 06:09:57 von bonomi

In article ,
Greg Andrews wrote:
>Michael Vilain writes:
>>In article <13gs0aio4f4mh6d@corp.supernews.com>,
>> bonomi@host122.r-bonomi.com (Robert Bonomi) wrote:
>>
>>> "KERMIT" is good for the latter approach to your problem.
>>>
>>> lastly, you -might- be able to use 'expect' to driver the FTP program,
>>> rather than a here-document in your script. With eough effort you can
>>> probably get 'expect' to figure out when a transfer failed. (easiest to
>>> *assume* it failed, and treat the 'transfer completed' message as the
>>> special condition that must be handled differently.
>>
>>You may be better off using something like perl with CPAN modules which
>>can ftp (libnet has an ftp module or you could grep the CPAN library).
>>
>
>All these suggestions can work, but they take a lot of effort
>to reinvent poorly what UUCP has done well for many years now.

Which:
(a) assumes uucp and all the required 'friends' are available on both
the source ad destination systems.
(b) assumes the OP has the appropriate administrative-level access to do
the required configuration on both systems to make it work.
(c) assumes the OP has the skills/time/inclination to wade through, create,
and test all the arcane onfiguration files require to make it work.

AND ignores far simpler alternatives for small-scale work, such as:
1) rcp
2) scp
3) rsync

Of course, all of those approaches have the same failing as the uucp
approach -- they _fail_to_meet_ the stated criteria of detecting the
successful/failed completion of an _FTP_TRANSFER_.