Date: Mon, 27 Nov 2000 04:07:48 -0500 From: Jim Conner <jconner@enterit.com> To: Ben Weaver <sid67@tranquility.net> Cc: david@banning.com, questions@FreeBSD.ORG Subject: Re: automatic ftp put Message-ID: <5.0.0.25.0.20001127035807.00ad4f88@mail.enterit.com> In-Reply-To: <20001127023642.A97243@tranquility.net> References: <200011270648.BAA01730@d.tracker> <200011270648.BAA01730@d.tracker>
next in thread | previous in thread | raw e-mail | index | archive | help
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)
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.20001127035807.00ad4f88>
