Back up your files using lftp

Source: Internet
Author: User
Use lftp to back up your file-Linux Enterprise Application-Linux server application information. For more information, see. From: http://www.linux.com/feature/122169

Every day I am tossing my computer, so important data cannot be backed up. Back up the data to your machine. In case the entire hard disk breaks down, the data will still be exhausted ...... It is best to back up data to another host. reinsurance can back up multiple copies on different hosts. If you can enable the ftp service on your computer, lftp can help you, back up your existing files on another computer.

First, familiarize yourself with the basic usage of lftp. If the ftp server is anonymous, As long:

Lftp ftpsite

You can log on to the server. If you need a user name and password, it will look like the following:

Lftp-u username, password ftpsite

After logging on to another computer, such as the ftp server, you only need to use the lftp mirror command to conveniently download the backup:

Mirror directory to be backed up stores the local directory of the backup computer

For example, mirror/work save/backup. lftp will automatically synchronize all files in the directory. You can also pass in parameters to the mirror command to control the synchronization behavior:

-- Delete: If no file exists in the remote directory and there is a local file, delete the file.

-- Only-newer: only download new files.

-- Exculde: does not contain a directory.

-- Verbose: Detailed output.

Example:

Mirror -- delete -- only-newer -- verbose/work backup/

Automatically back up the work folder of the remote computer, go to the backup folder of the local current directory, and delete files that do not exist, and only download the latest files, and then provide detailed output.

You can also use the-e Option of lftp to directly connect the command to lftp:

Lftp-u username, password-e "mirror -- delete -- only-newer -- verbose/work backup/" ftpsite

You can also use the at option to specify the backup time:

Lftp at 00:00-u username, password-e "mirror -- delete -- only-newer -- verbose/work backup/" ftpsite

In this way, the backup task will be executed at every night.

Then, how to restore the backup is very simple. You only need to add the -- reverse option to the mirror command:

Mirror -- reverse -- delete -- only-newer -- verbose/work backup/

In this way, lftp uploads the backup to the ftp server.
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.