[vox-tech] Automated backups of files on remote FTP server

Troy Arnold troy-vox at zenux.net
Thu Sep 28 12:13:11 PDT 2006


On Thu, Sep 28, 2006 at 12:05:50PM -0700, Richard S. Crawford wrote:
> I've been tasked with finding a way to backup our files on our remote host to 
> a local server on a regular basis.  Trouble is I can only get to the remote 
> host via FTP.  Both systems run Linux.
> 
> What's the best way to go about doing this?

Get the admin to install ssh...

Your request is a bit vague, but if it requires much logic I'd probably use
the Perl Net::FTP module.  Here's an example swiped from an existing
script:

sub downloadData
{
    print "Downloading data\n" if $debug;
    ## setup an ftp connection
    my $ftp = Net::FTP->new($ftpHost, Passive=> 0, Debug => $ftpDebug) or
die "Cannot connect to $host: $@\n";
    $ftp->login($ftpUser,$ftpPass) or die "Cannot login ", $ftp->message;
    $ftp->binary;
    $ftp->cwd('/') or die "Cannot change working directory ",
$ftp->message;
    $ftp->get($tarball,"$rawDir/$tarball") or die "Failed to retrieve
data:$tarball";
    $ftp->quit;
}

hth
-t



More information about the vox-tech mailing list