#!/bin/bash
find /usr/local/nginx/logs/ -mtime +15 -type f -name *.log | xargs rm -f

脚本名字autodellog.sh

设置定时器(每天凌晨一点执行)

[root@localhost ~]# crontab -e
00 01 * * * /bin/bash /root/shell/autodellogs.sh
[root@localhost ~]# service crond restart

 

相关文章: