Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 21 May 2001 07:21:36 +0100
From:      Alex Dyas <ADyas@twowaytv.com>
To:        freebsd-questions@FreeBSD.ORG
Subject:   RE: FTP shell script
Message-ID:  <911D8F660DF6D411B61F00500462BA017755F8@exchange.twowaytv.co.uk>

next in thread | raw e-mail | index | archive | help
Doug,

I think this may solve you problem:

<ftpscript>
#!/bin/sh
ftp 10.10.10.10 2>&1 <<!
bin
passive
cd /tmp
put alex.txt
!
</ftpscript>

Basically, between the two '!' characters you can put anything you would
normally type in an interactive FTP session.

This requires a .netrc on the local machine with the appropriate login privs
for the remote machine.

alex..

> Hi,
> 
> I need to have a scrip zip up a directory periodically, and 
> ftp it to a
> microsoft version ftp server.  The zip part was a snap.  But 
> I can't seem to
> get anywhere with the ftp part.
> 
> 1st, here is the last script I tried:
> 
> #! /bin/csh
> 
> zip -r /home/wwwroot/mrtg-backup.zip 
> /home/wwwroot/vhosts/mrtg.apc.net/*
> ftp ftp://myusername:mypassword@ftp.apc.net
> put mrtg-backup.zip
> by
> 
> OK, now clearly, this is wrong as 1) the following line are 
> never passed to
> the ftp server, but what has really been frosting me is 2) a 
> problem with
> passive transfers.
> 
> The ftp server I'm ftping to doesn't allow passive transfers 
> (goes REAL
> SLOW--really useless when trying to do passive), but when I 
> execute that
> script, it automatically enables passive transfers for the 
> session.  I have
> searched and searched for a .netrc, but found none to turn that off.
> 
> I know that at the command line, I can type passive, then it 
> will disable
> passive mode, but only for that session, and not in my script.  Since
> passive is default, I tried passing the -p in the initial ftp 
> line, but that
> only requested it!
> 
> Anyone got any ideas?
> 
> Thanks!
> 
> Doug.

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?911D8F660DF6D411B61F00500462BA017755F8>