tomcat切割日志的shell脚本
#!/bin/bash cd /usr/tomcats/ d=`date +%F` m1=`date -d'1 month ago' +%F` for i in `seq 8` do cd tomcat808"$i"/logs cp catalina.out catalina.out.$d echo " " > catalina.out rm -rf catalina.out.$m1 cd ../.. done
将脚本添加到任务计划中:05 02 * * * /bin/bash /usr/tomcats/tomcatlog.sh