I have a chache directory setup on Amazon EBS. I'm using it as a cache for an S3FS mounted file system that holds virtual backup tapes. The tapes are being used with Bacula.
The backup to the S3 mounted directory would be way to slow to be usable without some form of local cache. The storage on S3 is of course virtually limitless. So I need to clear out the /cache directory every so often.
I want to be able to delete tape files in that directory that are older than 15 minutes.
So I tried this command:
[root@ops:~] #find /cache/jf-backup/ -type f -daystart -mmin +15
/cache/jf-backup/jf-backup-tape-0073
/cache/jf-backup/jf-backup-tape-0074
And it does find the files. Howewver they are not older than 15 minutes:
[root@ops:~] #ls -l /cache/jf-backup/
total 6199968
-rw-------. 1 root root 5368688607 Feb 25 14:39 jf-backup-tape-0073
-rw-------. 1 root root 980074496 Feb 25 14:42 jf-backup-tape-0074
[root@ops:~] #date
Thu Feb 25 14:46:59 EST 2016
How can I get the find command to only find files that are older than 15 minutes? Once I do I want to delete those files with a command like this:
find /cache/jf-backup/ -type f -daystart -mmin +15 -exec rm -rf {} \;
From @Jan at https://unix.stackexchange.com/questions/155184/how-to-find-and-delete-files-older-than-specific-days-in-unix, try
find /PATH/TO/FILES -type f -mmin +15 -exec rm -f {} +