From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fee84,189746606d0bae92 X-Google-Attributes: gidfee84,public From: Phil Farrell Subject: Re: Help - I'm stuck in FTP and I can't get up Date: 1998/02/02 Message-ID: <34D6159B.3B45@pangea.stanford.edu>#1/1 X-Deja-AN: 321428569 Content-Transfer-Encoding: 7bit References: <6atsao$imb$1@newsbell.bellglobal.com> <6b1ori$l1k@eliot.oit.umass.edu> Mime-Version: 1.0 To: abutchar@log.on.ca Content-Type: text/plain; charset=us-ascii Organization: Stanford University School of Earth Sciences Newsgroups: comp.unix.osf.osf1 Peter deFriesse wrote: > > Somewhere off the top of my screen in article <6atsao$imb$1@newsbell.bellglobal.com>, > the esteemed abutchar@log.on.ca said: > > }I am trying to set up an automated process that will, while processing a > }shell script, ftp the results to the NT server from the alpha running Dec > }Unix. > > As it always is with UNIX, there is no *one* right way to do this; > there are several. This is one of them: > > #!/bin/sh > > ftp -n somehost << END__HERE > user username password > [ ftp commands here] > quit > END__HERE > > Two notes: You would want to keep this file PRIVATE since > there is a valid username/password in it. Also note that the > "END__HERE" string (called "hear document") at the end must > not be intented; start in column one. This kind of script generally does not work well because the commands are fed to ftp without waiting for any responses. Ftp may or may not correctly queue up the commands and execute them. I prefer a shell script that explicitly waits between commands by using a subshell to echo the commands to a pipe into the ftp program, e.g, #! /bin/sh (echo "user username password"; sleep 15; echo "cd directory"; \ sleep 15; echo "put file"; sleep 15; echo "quit" ) | ftp -n somehost You would adjust the "sleep" times (in seconds) so they will be long enough to encompass any delay that might occur on your systems or network. -- Phil Farrell, Computer Systems Manager Stanford University School of Earth Sciences farrell@pangea.stanford.edu