From: Phil Farrell <farrell@pangea.stanford.edu>
To: abutchar@log.on.ca
Subject: Re: Help - I'm stuck in FTP and I can't get up
Date: 1998/02/02 [thread overview]
Message-ID: <34D6159B.3B45@pangea.stanford.edu> (raw)
In-Reply-To: 6b1ori$l1k@eliot.oit.umass.edu
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
next prev parent reply other threads:[~1998-02-02 5:00 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
1998-01-30 5:00 Help - I'm stuck in FTP and I can't get up Andrew Butchart
[not found] ` <6b1ori$l1k@eliot.oit.umass.edu>
1998-02-02 5:00 ` Phil Farrell [this message]
1998-02-03 5:00 ` Mark Bartelt
1998-02-03 5:00 ` Nick Dokos
1998-02-08 5:00 ` Cameron Laird
1998-02-09 5:00 ` Kylan Coghlan
read-only archive
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox