#!/bin/bashBACKDIR=/backup/logs/`date +%F`CATDIR=/home/tomcat/apache-tomcat/logsBACKFILE=`find $CATDIR -type f -mtime +3|grep -v catalina.out`CESHI=`echo $BACKFILE|wc -l`LOGFILE=/home/lichuang/backup.logBackup (){if [ $CESHI -le 1 ]then echo ========`date +%F`======= >>$LOGFILE echo $BACKFILE >>$LOGFILE exit 0else mkdir -p $BACKDIR mv -f $BACKFILE $BACKDIR >>$LOGFILE if [ $? -eq 0 ] then tar zcf $BACKDIR.tar.gz $BACKDIR echo ===`date +%F` BACKUP_OK===>>$LOGFILE sleep 3 rm -fr $BACKDIR fifi}Backup