Tomcat日志备份脚本
#!/bin/bash
#Author:fansik
#Description:backup tomcat logs
#Date:2017-04-05
directory=/usr/local/tomcat/logs
backupdir=/data/upload/app/tomcatlog/tomcat1
datetime=`date +%F`
cleandir=/data/upload/app/tomcatlog
if [ "`ls -A $directory`" = "" ]
then
exit
else
cd /usr/local/tomcat/logs
tar zcf tomcat-${datetime}.tar.gz catalina.out
echo "" > catalina.out
mv *.gz $backupdir
fi
find $cleandir -mtime +14 -exec rm -rf {} \;