加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > 安全 > 正文

clean.sh

发布时间:2020-12-15 18:22:41 所属栏目:安全 来源:网络整理
导读:30 1 * * * /ecapp/soft/ECShellScript/clean/clean.sh /ecapp/soft/ECShellScript/clean/logs/clean.`date +%Y-%m-%d`.log 21 ? ls -lR /ecapp/soft|grep ‘^/ecapp/soft‘|grep -E "/logs:$" ? [[email?protected] clean]$ cat cleanlist /ecapp/soft/

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

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读