From owner-freebsd-questions Mon Nov 27 0:52:20 2000 Delivered-To: freebsd-questions@freebsd.org Received: from dc-mx06.cluster0.hsacorp.net (unknown [209.225.8.16]) by hub.freebsd.org (Postfix) with ESMTP id 15AA837B4C5 for ; Mon, 27 Nov 2000 00:52:16 -0800 (PST) Received: from [24.216.177.202] (HELO CONCON.enterit.com) by dc-mx06.cluster0.hsacorp.net (CommuniGate Pro SMTP 3.4b1) with ESMTP id 12449726; Mon, 27 Nov 2000 01:51:22 -0700 Message-Id: <5.0.0.25.0.20001127035807.00ad4f88@mail.enterit.com> X-Sender: jconner@mail.enterit.com X-Mailer: QUALCOMM Windows Eudora Version 5.0 Date: Mon, 27 Nov 2000 04:07:48 -0500 To: Ben Weaver From: Jim Conner Subject: Re: automatic ftp put Cc: david@banning.com, questions@FreeBSD.ORG In-Reply-To: <20001127023642.A97243@tranquility.net> References: <200011270648.BAA01730@d.tracker> <200011270648.BAA01730@d.tracker> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; format=flowed Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG 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