zoukankan      html  css  js  c++  java
  • centos定时删除log文件

    #!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 {} ;
    
  • 相关阅读:
    继承和多态
    访问限制
    返回函数
    类和实例
    requests
    函数的参数
    代码块的快速放置
    19进阶、基于TSP的直流电机控制设计
    18进阶、TLC语言
    17高级、Simulink代码生成技术详解
  • 原文地址:https://www.cnblogs.com/achengmu/p/12076357.html
Copyright © 2011-2022 走看看