To prevent an unexpected situation and cause the site to be unavailable, make a daily backup of the Tomcat entire station
Wrote a script placed in the/etc/rc.d/directory, named rotate.sh
To prevent daily backups from taking up too much space, delete the backups from 4 days ago and roll back the operations
1. Write Script rotate.sh
#!/bin/sh
Path= $PATH:/bin:/sbin
Export PATH
Year= ' Date +%y '
Month= ' Date +%b '
day= ' Date +%d '
now1= $year-$month-$day
now= $day/$month/$year
Cd/mnt/backup
Find./-type f-mtime +3-exec rm {} \;
cd/mnt/backup/
Tar zcvf aidonghtml$now1.gz/mnt/tomcat/
#mysqldump-uroot-p6112911218 aidong > Aidong$now1.sql
#mysqldump-uroot-p6112911218 aidong2 > Aidong2$now1.sql
#tar ZCVF aidong$now1.gz Aidong$now1.sql
#tar ZCVF aidong2$now1.gz Aidong2$now1.sql
#rm-RF *.sql
2. Execute the task plan and execute the above script at 7:7 A.M. every day
#crontab-L
7 7 * * */etc/rc.d/rotate.sh
3. View the results performed daily
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/7A/08/wKiom1ahhsbxYQU8AAAX-Vi4OU8622.png "title=" q@q~n0 ] (x152acw%_jqtgi9.png "alt=" Wkiom1ahhsbxyqu8aaax-vi4ou8622.png "/>
This article is from the "burning Years of Passion" blog, please be sure to keep this source http://liuzhengwei521.blog.51cto.com/4855442/1737522
Daily seven o'clock in the morning back up your company's web site plan