In linux, the backup is automatically packaged and deleted five days ago.
Project requirements
1. Automatically package a file directory,
2. The package file is automatically placed in a specified directory.
3. The files generated five days ago are automatically cleared;
Implementation:
1. Use crontab for Scheduled Backup
2. Use tar for compression
3. Use shell to calculate the date and remove the old file.
4. Add the backup file baksvn to the/usr/sbin directory.
#! /Bin/sh
Rq = 'date + % Y % m % d'
Rm-f/home/svnbak/'date-d'-5 days 'using policyuncm=d'.tar.gz
Tar zcvf/home/svnbak/$rq.tar.gz/var/svn/document
Likewise, mysql backup can be implemented.
You only need to add
Mysqldump-uroot-p XXXXXX>/home/XXXXXXx_bak_20150108.dat
As follows:
#! /Bin/sh
Rq = 'date + % Y % m % d'
Mysqldump-uroot-p XXXXXX>/home/XXXXXXx_bak _ $ rq. dat
Rm-f/home/svnbak/'date-d'-5 days 'using policyuncm=d'.tar.gz
Tar zcvf/home/svnbak/$rq.tar.gz/var/svn/document