[comp.unix.questions] ftp in background?

masticol@athos.rutgers.edu (Steve Masticola) (07/27/90)

I would like to ftp in several files from a remote site (using
anonymous ftp). The site is busy during most daylight hours, and even
when I can connect, the connection has been unreliable. Is there any
utility that can transfer files in background, and will retry on a
broken or uncompleted connection?

Thanks for your help,
- Steve (masticol@athos.rutgers.edu)

pemurray@miavx1.acs.muohio.edu (Peter Murray) (08/01/90)

In article <Jul.27.09.36.11.1990.20837@athos.rutgers.edu>, masticol@athos.rutgers.edu (Steve Masticola) writes:
> I would like to ftp in several files from a remote site (using
> anonymous ftp). The site is busy during most daylight hours, and even
> when I can connect, the connection has been unreliable. Is there any
> utility that can transfer files in background, and will retry on a
> broken or uncompleted connection?
> 
> Thanks for your help,
> - Steve (masticol@athos.rutgers.edu)

The program you are looking for can be found at simtel-20 [26.2.0.74], in
on of the pd3:<unix> directories.  I believe the name is AUTOFTP.

Peter
-- 
Peter Murray            Neat UNIX Stunts #7:             pemurray@miavx1.bitnet
215 Foxfire Dr #308         csh> %blow            murrayp@apsvax.aps.muohio.edu
Oxford, OH 45056                       NeXT Mail:  pmurray@next4.acs.muohio.edu

seaotter@athena.mit.edu (Stacy L Ramirez) (08/03/90)

In article <Jul.27.09.36.11.1990.20837@athos.rutgers.edu> masticol@athos.rutgers.edu (Steve Masticola) writes:
>
>I would like to ftp in several files from a remote site (using
>anonymous ftp). The site is busy during most daylight hours, and even
>when I can connect, the connection has been unreliable. Is there any
>utility that can transfer files in background, and will retry on a
>broken or uncompleted connection?
>
>Thanks for your help,
>- Steve (masticol@athos.rutgers.edu)

The following will not retry, but it should be simple to write a
second script to call this one and then check for the existence of the
desired fill until it exists or it has tried a certain number of times...

If you know the name of the site, the file, and the directory, I have
a shell script that will do the trick.  I call it gaf (for "get a file")
and use it thusly:

	% gaf site directory file1 file2 ... file6 > log.foo &

for example "% gaf pilot.njin.net /ftp-list ftp.list > log &" will get
the list of anonymous ftp sites stored at pilot in the directory ftp-list.
Actually the script I have is based on the script getfile found in that
directory -- it just accepts arguments for site and directory as well
as filename.  The file will be written to the user's site with the same name,
so care must be taken not to overwrite existing files.  The file log.foo
will contain the responses of the remote site and is useful if ftp fails
for whatever reason -- it will show if connection timed out, or whatever.

...and here it is...

PS - please IMPROVE this!  I didn't remember enough shell script to
do a really proper job at it, so it is UGLY!  Please fix it and email
me the improved version.  (It still WORKS, just inelegant.)

cut here ! cut here ! cut here ! cut here ! cut here ! cut here ! cut here

#!/bin/sh
#	Simple shell script to fetch a file
#
#	Syntax: gaf <site> <dir> <file> ...
#
#	based on "getfile" by Jon Granrose (odin@pilot.njin.net)
#

if [ $# -lt 3 ]
then
	echo "Usage: $0 <site> <dir> <file> ..."
	exit 1
fi

(
	echo user anonymous $USER

	echo hash
	echo binary

	echo cd $2

	if [ $# -ge 3 ]
	then
		echo get $3
	fi

	if [ $# -ge 4 ]
	then
		echo get $4
	fi

	if [ $# -ge 5 ]
	then
		echo get $5
	fi

	if [ $# -ge 6 ]
	then
		echo get $6
	fi

	if [ $# -ge 7 ]
	then
		echo get $7
	fi

	if [ $# -ge 8 ]
	then
		echo get $8
	fi

	echo bye

) | ftp -n -v $1

____Mike_Zraly____________________________________________________________
|	obligatory address	: c/o seaotter@athena.mit.edu		 |
|	obligatory disclaimer	: My views don't represent anyone but me |
|	obligatory quote	: Nothing takes the taste out of peanut  |
|				  butter quite like unrequited love.	 |
|							-- Charlie Brown |
:________________________________________________________________________:

skidrow@ceres.ucsc.edu (08/10/90)

masticol@athos.rutgers.edu (Steve Masticola) writes:


>I would like to ftp in several files from a remote site (using
>anonymous ftp). The site is busy during most daylight hours, and even
>when I can connect, the connection has been unreliable. Is there any
>utility that can transfer files in background, and will retry on a
>broken or uncompleted connection?

>Thanks for your help,
>- Steve (masticol@athos.rutgers.edu)

	Annette DeSchon has written a background FTP utility (BFTP)
	which you can use to repeatedly attempt to copy files over
	the net.  BFTP features session logging to record errors,
	verification of transfer parameters prior to copying, and
	many other useful features.

	Really handy for connecting to ftp-servers in obscure foreign
	places, or overloaded servers with time/user limits.

	Available at gatekeeper.dec.com (pub/net) and most other
	PD-sites.  There's an RFC that covers it.

						- Gary M. Lin
						skidrow@ceres.ucsc.edu