shell创建清理日志脚本
以如下apache日志为例:
#!/bin/bash
dirs=(/usr/local/apache/logs /usr/local/apache/htdocs/openshop/logs)
for dir in ${dirs[*]}
do
find $dir -mtime +7 -name "*.log*" -o -name "*.lqxshop*" | xargs rm -rf //保留最近7天的日志
done
本文转自yzy121403725 51CTO博客,原文链接:http://blog.51cto.com/lookingdream/1902986,如需转载请自行联系原作者