一:编写脚本
[root@localhost home]# vim clean_catalina.sh
# 删除 /opt/java/tomcat7/logs/下5天前,文件名称包含"201"的logs
find /opt/java/tomcat7/logs/ -mtime +5 -name "*201?*" -exec rm -rf {} \;
# 清空 /opt/java/tomcat7/logs/下的catalina.out
echo " " > /opt/java/tomcat7/logs/catalina.out
[root@localhost home]# chmod 755 clean_catalina.sh
欢迎光临 黑马程序员技术交流社区 (http://bbs.itheima.com/) | 黑马程序员IT技术论坛 X3.2 |