参考:http://www.2cto.com/os/201503/380262.html
每天晚上11点50切割日志文件,同时删除超过30天的日志
log_path=/usr/local/tomcat/logs d=`date +%Y-%m-%d` d90=`date -d'30 day ago' +%Y-%m-%d` cd ${log_path} && cp catalina.out $log_path/cron/catalina.out.$d.log echo > catalina.out rm -rf $log_path/cron/catalina.out.${d90}.log
添加权限
chmod 777 /shell/log.sh
编辑crontab
crontab -e
50 23 * * * sh /shell/log.sh