Intermediary transaction http://www.aliyun.com/zixun/aggregation/6858.html ">seo diagnose Taobao guest cloud host technology Hall
Automatic backup under Linux is important to the security of the data, how do you keep the data in the last few days when you do automatic backup? Below to the cloth classification Life Network www.yes81.net as an example to carry out the test, the website of the Forum to upload the submission of the attachment, The main system of the cloth Living website uploads the attachment as well as the database is an important data that must be backed up.
The server uses an array of dual hard drives, so the hard disk crash data is not worried, the main concern is due to system problems or misoperation caused by data loss.
1, hard disk partition backdata is specifically used as a backup
2, MyData is the data partition, MySQL is the database file directory, BBS is the forum file directory; Yes81 is the main station yes81.net file directory
Now our goal is to complete the automatic daily backup, and only 10 days of data retention, 10 days before the data automatically deleted
For this we have written the following automatic backup batch file, and in the crontab scheduling, increased the 3-point automatic daily tasks.
-----------------Bacpupdata.bat-------------------------------------
Cd/backdata
#----Delete backup 10 days ago
date-d -15-day +%y-%m-%d > Dd.txt
Read Dateold < Dd.txt
RM dd.txt-f
RM-RF $dateold
date-d -14-day +%y-%m-%d > Dd.txt
Read Dateold < Dd.txt
RM dd.txt-f
RM-RF $dateold
date-d -13-day +%y-%m-%d > Dd.txt
Read Dateold < Dd.txt
RM dd.txt-f
RM-RF $dateold
date-d -12-day +%y-%m-%d > Dd.txt
Read Dateold < Dd.txt
RM dd.txt-f
RM-RF $dateold
date-d -11-day +%y-%m-%d > Dd.txt
Read Dateold < Dd.txt
RM dd.txt-f
RM-RF $dateold
date-d -10-day +%y-%m-%d > Dd.txt
Read Dateold < Dd.txt
RM dd.txt-f
RM-RF $dateold
#-----File backup for the new Day
date-d 0-day +%y-%m-%d > Dd.txt
Read Date1 < Dd.txt
RM dd.txt-f
mkdir $date 1
RAR a/backdata/$date 1/database$date1.rar/mydata/mysql
RAR a/backdata/$date 1/bbs$date1.rar/mydata/bbs/web-inf/lybbs/upload
RAR a/backdata/$date 1/buyi$date1.rar/mydata/yes81
This paste copyright belongs to http://free.yes81.net/yes81/view-1169.html, reprint please copy this address