Logrotate to clean up date stamped files

后端 未结 6 1124
梦谈多话
梦谈多话 2021-01-31 17:22

I\'m currently trying to work out a method of tidying up Oracle Recover log files that are created by Cron...

Currently, our Oracle standby recover process is invoked b

6条回答
  •  暗喜
    暗喜 (楼主)
    2021-01-31 18:02

    You can use find command to do that task easily! It will delete all 7 Days old files. Put it in crontab and run nightly basis:

    $ cd /data/tier2/scripts/logs/    
    $ /usr/bin/find . -mtime +7 -name "*.log" -print -delete
    

    Or Better way

    $ /usr/bin/find /data/tier2/scripts/logs/ -mtime +7 -name "*.log" -print -delete;
    

提交回复
热议问题