[root@MPP01 /]#crontab -l
0 2 * * * /root/script/file_cleanup.sh  1>/dev/null 2>&1l
[root@MPP01 /]# more /root/script/file_cleanup.sh 
#!/bin/sh
#loong576
current_date=`date +'%Y-%m-%d'`
cleanup_date=`date +%Y-%m-%d --date="-30 day"`
log_file1=/log/umsservice
log_file2=/opt/AppServer/apache-tomcat-6.0.35/webapps/ums400/data/log
log_file3=/log/playagent
log_file4=/opt/AppServer/apache-tomcat-6.0.35/webapps/aesconnector/data/log
log_file5=/log/umseval
log_file6=/log/umssmsvalidate
log_file7=/opt/AppServer/apache-tomcat-6.0.35/logs

find $log_file1 -type f -mtime +40 -name 'trace.log.*' -exec rm -rf {} \;
find $log_file2 -type f -mtime +45 -name 'trace.log.*' -exec rm -rf {} \; 
find $log_file3 -type f -mtime +45 -name 'trace.log.*' -exec rm -rf {} \; 
find $log_file4 -type f -mtime +35 -name 'trace.log.*' -exec rm -rf {} \; 
find $log_file5 -type f -mtime +45 -name 'trace.log.*' -exec rm -rf {} \;
find $log_file6 -type f -mtime +45 -name 'trace.log.*' -exec rm -rf {} \;
find $log_file7 -type f -mtime +10 -name 'catalina.out..*' -exec rm -rf {} \;

log_file1日志文件保留40天,log_file2保留45天,即-mtime +xx表示xx天之前。