clean.sh
30 1 * * * /ecapp/soft/ECShellScript/clean/clean.sh >> /ecapp/soft/ECShellScript/clean/logs/clean.`date +%Y-%m-%d`.log 2>&1 ? ls -lR /ecapp/soft|grep ‘^/ecapp/soft‘|grep -E "/logs:$" ? [[email?protected] clean]$ cat cleanlist /ecapp/soft/ECShellScript/clean/logs /ecapp/soft/zabbix_agent/logs ?? [[email?protected] clean]$ cat clean.sh? #!/bin/sh echo "cleaning logs start......" filepath="/ecapp/soft/ECShellScript/clean/cleanlist" for fs in $( cat $filepath ) do echo "clean "$fs find $fs -name *20*.gz -mtime +30 -exec rm {} ; done for fz in $( cat $filepath ) do echo "gzip "$fz find $fz -name *20*[a-y,0-9] -type f -mtime +1 -exec /usr/bin/gzip -9 {} ; done exit 0 ? ls -lR /apache|grep ‘^/apache‘|grep -E "/logs:$" 30 1 * * * /apache/ECShellScript/clean/clean.sh >> /apache/ECShellScript/clean/logs/clean.`date +%Y-%m-%d`.log 2>&1 ? [[email?protected] clean]$ cat clean.sh? #!/bin/sh echo "cleaning logs start......" filepath="/apache/ECShellScript/clean/cleanlist" for fs in $( cat $filepath ) do echo "clean "$fs find $fs -name *20*.gz -mtime +30 -exec rm {} ; done for fz in $( cat $filepath ) do echo "gzip "$fz find $fz -name *20*[a-y,0-9] -type f -mtime +1 -exec /usr/bin/gzip -9 {} ; done exit 0 (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |