#!/bin/bash
### 设置 Nginx 日志文件的路径 ###
log_files_path="/opt/nginx/logs/"
### 设置 save_days 为五天 ###
save_days=5
###  删除修改时间和生成时间为 $save_days 前的日志文件 ###
#find $log_files_path -mtime +$save_days -exec rm -rf {} \;
find $log_files_path -mtime +$save_days -name "*.log"  -exec rm -rf {} \;

##修改文件时间为九天前###
###  touch -d "9 days ago" /opt/images/chat/1*  ###
###参考文档:  https://blog.csdn.net/u012062455/article/details/78388980 ###
###  00 2 * * *  root  /opt/sh/ShanChu.sh  ###
###  重启 crontab    systemctl restart crond   ###
###  重启 crontab    service crond restart  ###
