[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Hands off ftp





Well, you're working too hard, and reinventing the wheel :)...

ftp has scripting built into it. look for in the man page for sections
that talk about a .netrc file.

heres one i use to stick my ip in my webspace (for when dyndns.com goes
down)
#

machine www.net-link.net
login yelligs
password YeahLikeImGoingToTellYou
macdef init
cd ip
put index.html
quit

#EOF

SO, this says that when connecting to the machine www.net-link.net with a
login of yelligs and a passwd of YeahLikeImGoingToTellYou, the macro
definition that is run initialy changes to the ip directory and puts the
file index.html before quiting.

this has to be in $HOME/.netrc and chmod 600 (or maybe 660 .. but i know
it works with just 600)

to run it, you just execute this command:
	ftp www.net-link.net

Believe it or not, it all works :)

--
-------------------------------------------------------------------------------
         Finger syellig@deepthought.dyndns.com for PGP public keys.
-------------------------------------------------------------------------------

On Fri, 10 Jul 1998 bob@acm.org wrote:

> I want ot do ftp operations with a script, maybe kicking off
> that script from a cron job.
> 
> I tried things like...
> 
> ftp < scriptfile >out1 >&out2 
> 
> Where scriptfile is the usual sort of ftp session....
> 
>    open overthere.com
>    bobby
>    mypassword
>    cd /pub/upload/directory
>    lcd /home/bobby/myjunk
>    put latest.ad.greatest.tgz
>    cd /pub/download
>    get newestpackage.tgz
>    close
>    quit
> 
> The thing runs for a few seconds and then says
> ....stopped (ttyp output) or words to that effect.
> 
> If I type 
> ftp < scriptfile
> and wait, The thing works, but I have to press <ENTER> a couple
> of times.
> 
> I understnad that I have not surrogated all the I/O, but what have
> I missed?
> 
> Thanks for any answers in advance.
>                                                  ---> RGB <---
>