1./app/logs/ 里面的日志只保留7天的(apache每天生成一个文件)
[root@centos6 ~]# vi /server/scripts/del.sh
里面加上
find /app/logs -type f -name "access*.log" -mtime +7 | xargs rm –f;
或者加上
find /app/logs -type f -name "access*.log" -mtime +7 exec rm –f {} \;
[root@centos6 ~]# crontab –e
里面加上
00 00 * * * /bin/sh /server/scripts/del.sh > /dev/null 2>&1
-mtime 是指修改时间 +7 是指7天之前的 -7 是指最近7天的
-atime 是访问时间
-ctime 是改变时间