We have a Volume mounted to
/Vols/Logs
I need a simple self monitoring script to monitor the size of this folder, this basically contains files that can grow indefinitely (not one huge file but many files, somehting like oracle archivelogs).
I would like to use a cron job to monitor this directory and remove the files that are older than 7 days old (THIS IS ACCOMPLISHED USING):
find /Vols/Logs/*.dbf -mtime +7 -exec rm {} \;
i would like to use similar command to remove files regarless of their age when the folder '/Vols/Logs' grows beyond 1500Gigs.
I know I have to try something like this
find /Vols/Logs/ -type d -size +1500G
this is just not cutting it, It refuses to find anything of the sort, when
df -h /Vols/Logs
shows 1.6T
Gurus, Please Help.
the command find /Vols/Logs/ -type d is used to find the subfolder under /Vols/Logs, and I don't think the find command is the right command to measure the folder size.
If all the files are log files, you can plan the log rotate as below:
- gzip all log files old than 7 days. In most case you can save 90% space to compress log files.
- remove gz files old than 30 or 60 days.
That is a good idea, I will try that out, but if anybody has a suggestion pertaining to my roiginal request, I would still really appreciate it.
The amount used can usually found with "du". It always helps to know what Operating System you are running.
du -ks /Vols/Logs
It is inadvisible to delete all the Oracle Archive Logs. As a minimum avoid deleting the current log or anything created since the last backup. They contain transaction data which would be needed in the event of a disaster.
I assume that you already have process which causes Oracle to start a new Archive Log at regular intervals regardless of transaction rate. Don't even think about messing with an Oracle Archive Log file which is open by Oracle at the time.
The "gzip" advice is good.
put below command in cronjob, run it daily.
find /Vols/Logs -type f -name "*.dbf" -mtime +7 -exec gzip {} \;
find /Vols/Logs -type f -name "*.dbf.gz" -mtime +30 -exec rm {} \;