tcora@PICA.ARMY.MIL (Tom Coradeschi) (03/20/91)
Some folks on comp.sys.mac.comm have been enquiring about how to do ftp sessions with sumex, now that the 25 user limit has been imposed. The obvious solution is to run your ftp session at 5AM Pacific, but for left-coasters, and many of us to the east, that's a little difficult. One solution is to run your ftp session via a script. The following is one I've been using for a long time, and it seems to work quite well. In order to make the script capable of autonomously logging in (without your being there to give username and password), you need a '.netrc' file in your home directory. This file should have read and write permissions for the user only (chmod 600 .netrc), and be of the following format: machine sumex-aim.stanford.edu, login anonymous, password user@host.site.dom Fill in your own email address for the password. In order to run the shellscript during off hours, you can use one of these two methods (and I'm sure there are others). The first is to have the shellscript "sleep" for a given number of hours (seconds, actually). Let's say that it's 5PM, and you want the script to run at 2AM. 5PM->2AM= 9 hrs = 32,400 seconds. So, you type: (sleep 32400;sumex.get)& Where the sleep 32400 command waits for 9 hrs, and sumex.get is the name of your shellscript. The & character is the Cshell command to run the process in the background. If you run bourne shell or k shell or whatever, you'll have to dig around for the appropriate command to do that. The ; separator tells your shell environment to run the commands sequentially, so after 32,400 seconds, sumex.get executes, and (hopefully) gets you your files. The second method is to use the "at" command. Here, the syntax is a little simpler, but you must be sure that at runs on your system. Again, there may be an equivalent command on your particular system. Simply type: at 0200 sumex.get At 0200 hrs (2AM) sumex.get will execute. OK. On to the scripts. There are two files I'm including here, where one is the script and the other is the input file it looks for. In this case, I'm calling them sumex.get and sumex.files. Determining which is the script and which is the input file is left as an exercise for the reader:-} The shellscript does the following: It ftps to sumex, and tries to get the files called for in sumex.files. If it cannot successfully complete the ftp session, ie, some sort of an error is reported, that error is written to the errors file. The script checks on the size of the errors file, and if that file has size > 0, then it waits the interval you've designated, and tries the ftp session again. ====file sumex.get==== #!/bin/sh # Shell script to try repeatedly to get files via ftp from the host named # below. The host is repeatedly polled until the session is successfully # completed. # This is the site we're ftp'ing to. host=sumex-aim.stanford.edu # Define the input, result and error files. in=sumex.files out=$host.results err=$host.errs # How long to sleep between subsequent tries (in seconds): #time=600 # Ten minutes time=3600 # An hour #time=7200 # Two hours echo "Starting to get files from $host." > $out # Try to make connection w/out error loop first time # Initialize the error message file so we start the loop: echo "Trying to reach $host at time:" >> $out date +'%H:%M hrs; %d %h %y' >> $out ftp $host < $in >> $out 2> $err # MAIN LOOP: If error file isn't empty, we sleep for an hour and try again. while test -s $err do echo "Cannot connect now, will try again in $time seconds." >> $out sleep $time echo "Trying to reach $host at time:" >> $out date +'%H:%M hrs; %d %h %y' >> $out ftp $host < $in >> $out 2> $err done echo "File transfer successful!" >> $out ====end sumex.get==== The input file merely contains the commands you would type in, if you were doing this manually. Make sure!! that you include the quit command on the last line. ====file sumex.files=== cd info-mac/card get el-verbo-simple.hqx cd ../init get randomizer.hqx quit ====end sumex.files==== I hope that my explanation has been clear enough. Really all you should have to do is to edit out all my bs and save the two files off separately. Make sure that the shellscript is executable ('chmod 744 sumex.get' should do it), and off you go... tom coradeschi <+> tcora@pica.army.mil <+> tcora@dacth01.bitnet PS: If your system doesn't run some sort of unix (UNIX, A/UX, SunOS, etc), all bets are off.
francis@arthur.zaphod.uchicago.edu (Francis Stracke) (03/20/91)
In article <9103191226.aa09785@FSAC1.PICA.ARMY.MIL> tcora@PICA.ARMY.MIL (Tom Coradeschi) writes: Some folks on comp.sys.mac.comm have been enquiring about how to do ftp sessions with sumex, now that the 25 user limit has been imposed. I'd like to point out that I've only once run into this limit. (Of course, I tend to work a bit late--but rarely as late as all that. :-) One solution is to run your ftp session via a script. The following is one I've been using for a long time, and it seems to work quite well. Very nice. [...] of your shellscript. The & character is the Cshell command to run the process in the background. If you run bourne shell or k shell or whatever, you'll have to dig around for the appropriate command to do that. It's the same. (It's probably the same on all shells--sh came up with it, and everybody seems to have inherited it.) The second method is to use the "at" command. Here, the syntax is a little simpler, but you must be sure that at runs on your system. And that you've got permissions--talk to your sysadmin. -- /============================================================================\ | Francis Stracke | My opinions are my own. I don't steal them.| | Department of Mathematics |=============================================| | University of Chicago | Until you stalk and overrun, | | francis@zaphod.uchicago.edu | you can't devour anyone. -- Hobbes | \============================================================================/
boogles@athena.mit.edu (Brian K Zuzga) (03/27/91)
Why doesn't sumex-aim have a mail-server? It is a much more efficient way of managing the load on the ftp server, at a minimal cost to network load. Even better yet, use Prospero.
dan@gacvx1.gac.edu (03/27/91)
In article <1991Mar26.175948.26899@eddie.mit.edu>, boogles@athena.mit.edu (Brian K Zuzga) writes: > Why doesn't sumex-aim have a mail-server? > It is a much more efficient way of managing the load > on the ftp server, at a minimal cost to network load. > Even better yet, use Prospero. SUMEX-AIM doesn't need a mail server. Mail servers already exist that mirror the SUMEX-AIM archives. Check out "MACSERVE@PUCC.PRINCETON.EDU". I think the LISTSERV at RICE also has a mirror archive. -- Dan Boehlke Internet: dan@gac.edu Campus Network Manager BITNET: dan@gacvax1.bitnet Gustavus Adolphus College St. Peter, MN 56082 USA Phone: (507)933-7596