set up Scheduled Tasks
Crontab-e
1 0 * * */bin/find/mnt/tomcat/logs/-mtime +3-type f-name "*.log"-EXEC/BIN/RM-RF {} \; Clear tomcat log script every morning at a time of the week
Tomcat automatic backup under Linux1, the page file in the/home/edn/tomcat6/webapps directory, the backup file is stored in the/home/backup directory.shell#vi/home/backup.sh#!/bin/shCd/home/backuphtdocsname= ' htdocsbak ' date +%y%m%d '. tar.gz 'tar cvzf $htdocsname/home/edn/tomcat6/webapps/*It's simple! Don't forget Chown 700/home/backup.sh.re-edit cron timed executionshell#crontab-e0 2 * * */home/backup.sh0 3 * * */usr/bin/find/home/backup-ctime +10-exec rm {} \;backups are performed at 2 O ' Day, and the first 10 days are removed 3 o'clock to avoid full drive:)take the following command when you're done with the recovery.Rm-rf/home/edn/tomcat/webappsTar xzvf/home/backup/htdocsbakxxxxxx.tar.gzBackup of MySQLmysqlname= ' mysqlbak ' Date +%y%m%d '. SQL '//define $mysqlname=mysqlbak year-month-day. SQLmysqldump edn > $mysqlname//backup edn database named $mysqlnameput the above two pieces of code in the Backup.sh folder and execute them together.
Linux Common functionality script