首页 > 其他 > 详细

centos定时删除log文件

时间:2019-12-21 13:23:10      阅读:179      评论:0      收藏:0      [点我收藏+]
#!bin/bash
#获取年
time=$(date "+%Y")

#查找并删除7天前的文件
find /opt/applog/travelsky -type f -mtime +7 -exec rm -f {} \;
find /xcx/hislogs/logs -type f -mtime +7 -exec rm -f {} \;

#查找并删除7天前的文件
find /usr/local/proxy-web/logs -type f -mtime +7 -exec rm -f {} \;

查找并删除7天前的文件
find /var/www/html/wxsdairpro/log/ticket  -mtime +7 -exec rm -f {} \;
查找并删除空目录
find /var/www/html/wxsdairpro/log/ticket/$time -exec rmdir -p {} \;
find /var/www/html/wxsdairpro/log/ticket/$time  -mtime +7 -exec rm -f {} \;

find /var/www/html/wxsdairpro/log/order  -mtime +7 -exec rm -f {} \;
find /var/www/html/wxsdairpro/log/order/$time   -exec rmdir -p {} \;
find /var/www/html/wxsdairpro/log/order/$time  -mtime +7 -exec rm -f {} \;

find /var/www/html/wxsdairpro/log/mohe -mtime +7 -exec rm -f {} \;
find /var/www/html/wxsdairpro/log/mohe/$time   -exec rmdir -p {} \;
find /var/www/html/wxsdairpro/log/mohe/$time -mtime +7 -exec rm -f {} \;

find /var/www/html/wxsdairpro/log/checkinsure -mtime +7 -exec rm -f {} \;
find /var/www/html/wxsdairpro/log/checkinsure/$time   -exec rmdir -p {} \;
find /var/www/html/wxsdairpro/log/checkinsure/$time -mtime +7 -exec rm -f {} \;

find /var/www/html/wxsdairpro/log/checkin -mtime +7 -exec rm -f {} \;
find /var/www/html/wxsdairpro/log/checkin/$time   -exec rmdir -p {} \;
find /var/www/html/wxsdairpro/log/checkin/$time -mtime +7 -exec rm -f {} \;

 

centos定时删除log文件

原文:https://www.cnblogs.com/achengmu/p/12076357.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!