Date: Tue, 28 Nov 2000 00:04:04 -0500 From: Jim Conner <jconner@enterit.com> To: David Banning <david@banning.com> Cc: freebsd-questions@FreeBSD.ORG Subject: Re: automatic ftp put Message-ID: <5.0.0.25.0.20001128000140.03a037d0@mail.enterit.com> In-Reply-To: <20001127123402.A3423@www3.pacific-pages.com> References: <5.0.0.25.0.20001127035807.00ad4f88@mail.enterit.com> <200011270648.BAA01730@d.tracker> <200011270648.BAA01730@d.tracker> <20001127023642.A97243@tranquility.net> <5.0.0.25.0.20001127035807.00ad4f88@mail.enterit.com>
next in thread | previous in thread | raw e-mail | index | archive | help
I made a simple mistake...I will fix that now...see below.
At 12:34 PM 11/27/2000 -0500, you wrote:
>My actually wish is just to update 1 file - index.html;
>
>So here is how I modified the script;
>
>#!/usr/local/bin/bash
>USER="myusername"
>PASSWORD="mypassword"
>
>ftp_function() {
> # Login
> echo "$USER"
> echo "$PASSWORD"
>
> # change local dir (if necessary)
> echo "lcd /usr/david/web"
# add this!
echo "as"
> # change to binary transfer (use "as" for
> # an ascii transfer)
> echo "put index.html" <-- you really should make a practice of
> placing the whole path here too.
>
> # wave goodbye.
> echo "by"
>EOT
>}
># Connect with non-interactive ftp session (-i)
># and restrain attempt to auto-login (-n)
># ftp(1)
>
>ftp_function | ftp -ni
>
>
>As mentioned - my error is;
>
>?Invalid command.
>?Invalid command.
>?Invalid command.
>?Invalid command.
>?Invalid command.
>?Invalid command.
>?Invalid command.
>?Invalid command.
>?Invalid command.
>?Invalid command.
>
>
>
>
>On Mon, Nov 27, 2000 at 04:07:48AM -0500, Jim Conner wrote:
> > FTP from a script is easy
> >
> > #!/bin/ksh
> >
> > USER="whoever"
> > PASSWORD="whatever"
> >
> > ftp_function() {
> > # Connect with non-interactive ftp session (-i)
> > # and restrain attempt to auto-login (-n)
> > # ftp(1)
> > ftp -ni << EOT
> >
> > # Login
> > echo "$USER"
> > echo "$PASSWORD"
> >
> > # change local dir (if necessary)
> > echo "lcd $localDir"
> >
> > # change remote directory (if necessary)
> > echo "cd $remoteDir"
> >
> > # change to binary transfer (use "as" for
> > # an ascii transfer)
> > echo "bi"
> >
> > # get your files. Use echo "mput $files"
> > # to put files to the remote side.
> > echo "mget $files"
> >
> > # wave goodbye.
> > echo "by"
> > EOT
> > }
> >
> > files=$(ls /path/*.ext)
> > remoteDir="/PATH/To/REMOTE"
> > localDir="/PATH/TO/LOCAL"
> >
> > ftp_function
> >
> > Its late...so if I got anything wrong, I apologize.
> >
> > - Jim
> >
> >
> > At 02:36 AM 11/27/2000 -0600, Ben Weaver wrote:
> > >I wanted to do the same thing with a site I was working on and updating
> > >frequently. Here's what I threw together:
> > >
> > >On my workstation I have a shell script called syncronize. Here it is:
> > >
> > >#!/bin/sh
> > >tar cvzf - directory_to_publish | ssh username@server ./server_sync
> > >
> > >Keep in mind for this to work, the directory_to_publish must be a
> > >subdirectory of the directory syncronize is in. You can change this as
> > >you like by altering the tar flags.
> > >
> > >On the server I made a shell script in my home directory called
> server_sync:
> > >
> > >#!/bin/sh
> > >dd of=tmp.tar.gz
> > >rm -R /path/to/website/root/directory/*
> > >tar xvzf tmp.tar.gz -C /path/to/website/root/directory/
> > >rm tmp.tar.gz
> > >
> > >That's about it... It's pretty crude, but it works for what I need it
> to do.
> > >
> > >-Ben
> > >
> > >On Mon, Nov 27, 2000 at 01:48:18AM -0500, David Banning wrote:
> > > > I am trying to update my website automatically, but
> > > > as far as I can see, there is no way to use ftp from a script.
> > > >
> > > > Am am now looking at ssh/scp but I find it confusing.
> > > >
> > > > Can anyone suggest how I can do what I want?
> > > >
> > > >
> > > > To Unsubscribe: send mail to majordomo@FreeBSD.org
> > > > with "unsubscribe freebsd-questions" in the body of the message
> > > >
> > >
> > >
> > >To Unsubscribe: send mail to majordomo@FreeBSD.org
> > >with "unsubscribe freebsd-questions" in the body of the message
> >
> >
> > - Jim
> > - NOTJames
> > - jconner@enterit.com
> >
> > -
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > - | Today's errors, in
> contrast: |
> > - | Windows - "Invalid page fault in module kernel32.dll at
> 0032:A16F2935" |
> > - | UNIX - "segmentation fault - core
> dumped" |
> > - | Humans - "OOPS, I've fallen and I can't get
> up" |
> > -
> --------------------------------------------------------------------------
> > - (To view this properly use a non-proportional font in your MUA)
> >
> >
>
>--
>A diplomat is someone who can tell you to go to hell in such a way that
>you will look forward to the trip.
- Jim
- NOTJames
- jconner@enterit.com
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- | Today's errors, in contrast: |
- | Windows - "Invalid page fault in module kernel32.dll at 0032:A16F2935" |
- | UNIX - "segmentation fault - core dumped" |
- | Humans - "OOPS, I've fallen and I can't get up" |
- --------------------------------------------------------------------------
- (To view this properly use a non-proportional font in your MUA)
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?5.0.0.25.0.20001128000140.03a037d0>
