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