What We Sell
Social Networks
For Developers
Manufacturer Support
Training & Certification

FTP backup and sync with lftp

Share your tips and tricks with the community

FTP backup and sync with lftp

Postby ccccp » Wed Apr 06, 2011 3:17 pm

LFTP is sophisticated file transfer program with command line interface. It supports FTP, HTTP, FISH, SFTP, HTTPS and FTPS protocols. GNU Readline library is used for input.
This is how it works
to get it do

yum install lftp

creat file sync in home dir
nano ftpsync

lftp -u yourFTPusername,yourpassword ftp.provider.com/MyLinuxPC/
mirror -R -v /var/spool/asterisk/monitor/ .
mirror -R -v /var/spool/asterisk/voicemail/.

then create MyLinuxPC folder in your ftp dir

after that you can run it with
lftp -f ~/ftpsync

All of the files in your chosen folder will be uploaded to FTPdrive. When you next run the command, only the changed files will be uploaded. When you’re happy with the script and once the first upload has completed, you can add the script to your crontab to schedule it to run every hour. Just type the command:

crontab -e

And add the following line to your crontab file:

0 * * * * lftp -f ~/ftpsync

This will tell your system to run the script every hour, on the hour, so your files are being constantly backed up. Make sure you’ve completed that initial upload first though – as if your upload takes more than an hour then you’ll end up with two versions of lftp running and both syncing the same files.

taken from here
Fresh Boarder
Fresh Boarder
Posts: 29
Joined: Tue Jan 18, 2011 12:15 am
Karma: -1

Return to Tips and Tricks

Who is online

Users browsing this forum: No registered users and 1 guest