Activities

February 2010
M T W T F S S
« Jan   Mar »
1234567
891011121314
15161718192021
22232425262728

How do I syncronize the FTP files/ incremental FTP backup

I want to backup all the files on the live server to keep on my backup server. How I can do this ?

This help you to reduce the download files locally and then upload it to server. Using this we can do this at the server side itself.

I prefer lftp to do this. Using lftp we can either synchronize the local files to a remote location or wise versa.

1. How do I syncronise the a folder on a FTP location to my local Linux server.

Suppose these are my remote ftp details:

FTP : 208.74.34.93
User: user
Password : pass
Ftp backup folder: securedata

[root@web-test1 ~]# yum install lftp*

Then

#lftp -u user,pass -e "mirror --delete --only-newer --verbose /securedata  /Backup/local/webfiles" 208.74.34.93

I simply create script file and add this to a daily cron job,

[root@rc-040 scripts]# crontab -l
10 12 * * *  /bin/sh /home/installation/scripts/marketbkp.sh

Second one is, copying the local files and upload to a remote ftp location. Just append the word “–reverse” to the existing command line path and switch the source and destination reversely.

#lftp -u user,pass -e "mirror  --reverse --delete --only-newer --verbose  /Backup/local/webfiles  /securedata " 208.74.34.93

Which would upload/synchronize all the files from the locally and upload to the remote location. This would be very helpful in case of disaster management. I do create a script for this.

If you want to move the files to a remote FTP location ie you do not wish to keep the files locally once it is copied to the local ftp place holder.

 mirror  --reverse --Remove-source-files  --verbose  /home/domain/public_html/media/images/perspective   /media/images/perspective

This saved many hours whenever I need to migrate huge files on shared hosting to a dedicated server. Really a Life saver 🙂

How to backup files from CPanel server

The following shows backing up all the files from remote ftp to local system.

Eg :

lftp -u user_name,password -e "set ftp:ssl-allow off;mirror --delete --only-newer --verbose /   /path/to/local/folder " ftp_server_name

Leave a Reply

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>