Click to See Complete Forum and Search --> : Backing/Updating up via ftp?


Fryguy8
05-12-2004, 09:00 PM
Say I have a web page, and I have a local copy of all of the documents. I'd like a way to sync what I have on my hard drive with a remote server that I only have ftp access to.

Or lets say I have a large programming project, and I'm super paranoid of hard disk failure, and I want to keep a copy of the project on a remote server that I only have ftp access to.

How would I go about making sure that the ftp server has the latest versions of the documents (something like a cronjob running once a day is sufficient). rsync isn't an option, as I only have ftp access.

mdwatts
05-13-2004, 03:04 PM
See if these will work.


http://linux.maruhn.com/sec/ftpbackup.html

This utility allows you to backup your filesystem(s) and/or directories to a remote ftp server. Similarly it permits restoring of files from remote ftp servers. Backup and restore is done without the use of temporary files, which is helpful when you have no extra space. Addtionally, this utility can be used to view the contents of remote files without actually putting them on disk (or just retrieve a subset of the remote archive). This is accomplished by sending stdin to ftp, or taking the remote ftp file and sending it to the local standard output. Flexibillity is achieved by piping to cpio, tar, gzip etc. The C ftp I/O library included might also be useful. (from rpm description)


A script


#!/bin/bash
#Backup Script for Local Server Incremental Backups
#Broadcast Start of Backup - Uncomment Next Line
#wall A system backup is currently being performed...
mkdir /backup
cd /
cd backup
#Tar files for this backup
tar -cvf fullback.tar /filesystem to backup here
#Create the tar file
gzip -f fullback.tar
#Mail the Administrator
#There is a file called system.txt in the same directory
#as all of our backup scripts. This file contains the
#name of the system and is used to identify the source
#of the files if needed
mail user@host.com -s "FTP Backup Done" -v < system.txt
#Copy the tar file to the backup directory on the local host
cp fullback.tar.gz /backup
rm fullback.tar.gz
#FTP the file to the backup directory on the backup server
ftp -in <<EOF
open IP.ADDRESS.OF.SERVER
user USERNAME PASSWORD
bin
hash
prompt
dele fullback.tar.gz
put fullback.tar.gz
bye
wall The current backup was FTP'ed to the backup server. Please check status...
wall A system backup has completed... Files FTP'ed to Backup Server


Perhaps

http://tennis.ecs.umass.edu/~czou/linux/backupSSH.html

serz
05-13-2004, 04:40 PM
One thing you can do is use curl to upload files easily.

Example:

curl -u user:password -T /path/to/file/to/upload ftp://ftp.whatever.com/path/you/want

Fryguy8
05-13-2004, 05:42 PM
hrmm, curl with a combination of ls-lr.txt on the ftp server. get the ls-lr.txt, and then one by one compare the modified dates with what's in the ls-lr, and when they differ, upload the file....

mdwatts
05-13-2004, 05:50 PM
Thanks for the suggestion serz and I may look into that one of these days. :)