Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!snorkelwacker!bloom-beacon!seaotter From: seaotter@athena.mit.edu (Stacy L Ramirez) Newsgroups: comp.unix.questions Subject: Re: ftp in background? Keywords: ftp, background Message-ID: <1990Aug2.234146.12255@athena.mit.edu> Date: 2 Aug 90 23:41:46 GMT References: Sender: daemon@athena.mit.edu (Mr Background) Distribution: na Organization: Massachusetts Institute of Technology Lines: 101 In article 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 ... # # based on "getfile" by Jon Granrose (odin@pilot.njin.net) # if [ $# -lt 3 ] then echo "Usage: $0 ..." 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 | :________________________________________________________________________: