Server more, the site is more and more, always feel not the whole backup heart, and there are several times RM operation errors, resulting in irreparable damage. And most VPS providers are not providing automatic backup functionality or this feature charges slightly higher prices. So it is necessary for me to put this work into practice, and maybe one day it will be used.
Use of the backup space I am using GoDaddy online Storage, the advantage is that my VPS are the United States service providers, choose GoDaddy space transmission speed is more assured that the most critical price can also be accepted, 100G space less than 30 dollars a year, In view of the current U.S. dollar rate on the renminbi, this price I think has been quite favorable.
The script is very simple, you can modify the relevant content according to their needs, here the main reference to the Linux VPS Automatic backup: Script upload FTP and rsync incremental backup, I mainly for the Debian system slightly adjusted a sentence, we can refer to the
First you need LFTP installation:
The code is as follows |
|
# yum-y Install Lftp |
Make sure it's ready! (Available lftp-v detection)
The code is as follows |
|
Then VI backup.sh |
Then copy the code and modify your host-related parameters and passwords:
Script Download: https://github.com/nonozone/TEMP/blob/master/AutoBackupToFtp.sh
To add execute permissions to a script:
The code is as follows |
|
chmod +x/root/backup.sh |
Use System crontab to achieve automatic daily operation:
The code is as follows |
|
Crontab-e |
Enter the following content:
The code is as follows |
|
0 1 * * */root/backup.sh |
Of these, 0 1 is the time division/hour, can be modified by itself, for example: 30 12 * * *, is to run the script 12:30 every day.