[Sussex] Automated FTP

Karl E. Jorgensen karl at jorgensen.com
Sat Jul 10 13:09:26 UTC 2004


On Sat, Jul 10, 2004 at 01:18:16PM +0000, Matthew Macdonald-Wallace wrote:
> Hi,
> 
> As part of a project I'm working on, I need to be able to automate the
> ftp process.
> 
> Basically, I need to send a file to an email address, this then uploads
> it to the server.  The problem is that the server is not mine, it is a
> webhosting account that will not allow me ssh or any other kind of shel
> access.

!? Ftp or email?  Must be a strange hosting company if they only want to
accept email attachments!?  Authentification must be a real PITA for
them...

I assume that we're talking plain ftp upload here...

> is it possible to do this using ftp and a shell script with cron?
> 
> I would need to upload the file to _remote_/htdocs/someDir/ from
> _local_/home/$user

For my own website, I prepare the files locally and then use sitecopy
( http://www.lyra.org/sitecopy/ ) to push any changes to the web server.

Of course, a *really cool* solution would be to use the virtual ftp file
system module, combined with use cp(1) or rsync(1) but I haven't tried
that yet...

If that won't cut it then read on...

I don't know which Linux distro you're using, but in Debian we have a
couple of packages that should help:

    Package: sitecopy
    Description: A program for managing a WWW site via FTP, DAV or HTTP
     sitecopy is for copying locally stored websites to remote ftp
     servers.  With a single command, the program will synchronize a set
     of local files to a remote server by performing uploads and remote
     deletes as required.
     The aim is to remove the hassle of uploading and deleting
     individual files using an FTP client.  sitecopy will also
     optionally try to spot files you move locally, and move them
     remotely.

    Package: ftp-utils
    Description: ftp support for shell scripts
     ftp-utils is a small collection of shell tools for the FTP
     protocol. Using it, you can write shell scripts which work equally
     well for both local file systems and remote file systems accessed
     via FTP.

     Included in the distribution is a simple shell script to build or
     maintain an FTP-mirror (pushing from origin to mirror)

    Package: ftp-upload
    Description: put files with FTP from a script
     ftp-upload transfers local files to another machine using FTP.
     It's meant to be used by scripts and such rather than
     interactively.  There's no user interface, the program is
     controlled strictly via the command line.  It is disciplined with
     its exit status.

In the past I've used lftp(1) for that - it can take commands on the
command line.

> This email has been independently scanned for viruses and any virus
> detected has been removed using McAfee anti-virus software

whatever. Why advertise for them?

Hope this helps
-- 
Karl E. Jørgensen
karl at jorgensen.com   http://karl.jorgensen.com
"One disk to rule them all, One disk to find them. One disk to bring
 them all and in the darkness grind them. In the Land of Redmond
 where the shadows lie." -- The Silicon Valley Tarot
          Henrique Holschuh
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://mailman.lug.org.uk/pipermail/sussex/attachments/20040710/1a850ebe/attachment.pgp 


More information about the Sussex mailing list