Ubuntu uses LFTP and cRON to automatically back up data to the FTP server every day.

Source: Internet
Author: User
Tags ftp file
The lab bought a new FileServer for backup. A student's hard disk in the lab broke down a few days ago, so I also set up the automatic backup function. The first thing to do is to see what type of FileServer is. In fact, if FileServer is built using the UbuntuLinux system (with ssh), it can be directly implemented using rsync. However, if FileServer is a common FTP, LFTP is a good choice. There are also some examples of LFTP in Chinese on the Internet for reference.

The lab bought a new File Server for backup. A student's hard disk in the lab broke down a few days ago, so I also set up the automatic backup function.

First of all, we need to see what type of File Server is. In fact, if File Server is built on Ubuntu Linux (with ssh), it can be directly implemented using rsync.

However, if the File Server is a common FTP, LFTP is a good choice. There are some examples of LFTP in Chinese on the Internet for reference. In fact, I only use the mirror function.

Lftp-u username, password-e "mirror-R -- only-newer path/to/source_directory path/to/target_directory" ftpsite

This command means to mirror the file from the local directory to the remote directory of FTP.

To enable the system to automatically back up your data, you need to set cRON. CRON is a tool for implementing automatic command execution in Linux.

Run

Crontab-e

You can edit the command to be automatically executed:

5 0 ***/usr/bin/lftp-u user, password-e "mirror -- only-newer-R/source_dir/target_dir" ftpsite>/home/xxx/tmp/cron. log 2> & 1

The above command line means to execute the command using LFTP at every day and save the executed message to tmp/cron. log (this file has been created in advance ).

OK! In this way, your system will automatically back up files to the FTP File Server every day.

LFTP details: Click here
LFTP: Click here

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.