centos添加定时任务,定时清理网站日志

使用 crontab -e 添加如下命令:
* * */5 * * find /home/wwwlogs -name '*.log' -exec rm -rf {}\;
* * */5 * * find /home/wwwlogs -name '*_log' -exec rm -rf {}\;

重新加载任务:
systemctl reload crond

每隔5天清理一次日志

posted @ 2020-03-19 09:39  likecs  阅读(416)  评论(0编辑  收藏  举报