标签:lin mnt min tomcat pat tom dmi bsp class
1 Shell脚本案例 删除超过30天的日志文件
#!/bin/bash log_path=/mnt/software/apache-tomcat-9.0.0.M22/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/catalina.out.${d90}*.log rm -rf $log_path/localhost.${d90}*.log rm -rf $log_path/student/talkilla-student*.${d90}*.log rm -rf $log_path/wechat/talkilla-wechat*..${d90}*.log rm -rf $log_path/teacher/talkilla-teacher*.${d90}*.log rm -rf $log_path/consultant/talkilla-consultant*..${d90}*.log rm -rf $log_path/admin/talkilla-admin*.${d90}*.log
2 配置定时执行,每天23点30分执行一次
crontab -e 30 23 * * * root sh /mnt/software/shell/clear-tomcat-log.sh
标签:lin mnt min tomcat pat tom dmi bsp class
原文地址:https://www.cnblogs.com/QuestionsZhang/p/10329577.html