I need help in rotating logs.
A folder /tftpboot holds following directories, these directories are created everyday automatically, these are backup folders, that is they hold backup of data.
drwxr-xr-x 2 phone phone 4096 Nov 1 13:19 1nov09.bkp
drwxr-xr-x 2 phone phone 4096 Nov 2 13:19 2nov09.bkp
drwxr-xr-x 2 phone phone 4096 Nov 3 13:19 3nov09.bkp
drwxr-xr-x 2 phone phone 4096 Nov 4 13:19 4nov09.bkp
drwxr-xr-x 2 phone phone 4096 Nov 5 13:19 5nov09.bkp
drwxr-xr-x 2 phone phone 4096 Nov 6 13:19 6nov09.bkp
drwxr-xr-x 2 phone phone 4096 Nov 7 13:19 6nov09.bkp
drwxr-xr-x 2 phone phone 4096 Nov 8 13:19 6nov09.bkp
I need to set up an entry in logrotate to delete these backup directories in /tftpboot directory that are greater than 1 week old.
Can someone help me how to do the same?
Explanation :
1. This configuration is for /tftpboot/*.bkp files
2. Daily it will watch
3. nocreate- it wont create if the (todays) current date file doesn't exist.
4. rotate 1 - it needs to compressed and rotated only once (because all the files will be with unique name).
5. compress - enable default compress gzip
6. missingok - if the file is missing it should not stop with error
7. After rotation it executes the find command which removes 1 week old files
thanks for the reply and solution... I want to ask you a question that *.bkp are directories and not files under /tftpboot directory. I am not sure if we can rotate directories using logrotate.