So I have this logrotate config file. I want to delete files that older than 2 days. After the first day, it add .1 to the filename of all the files that older than 2 days instead of deleting those files Then after the second day, still not deleting those file. I am not sure where I did wrong. But it works if I force run it logrotate -f '/etc/logrotate.d/configname'
Here's the config file I created
/data/adrouters/*/IAV/*/* /data/adrouters/*/logs/* /data/adrouters/*/SchOutIav/*/* /data/adrouters/*/SiteInfo/archive/* /data/logs/* {
missingok
rotate 1
nocreate
nodateext
ifempty
lastaction
find /data/adrouters/ -type f -mtime +2 -exec rm {} ;
find /data/logs/ -type f -mtime +2 -exec rm {} ;
endscript
}
See Question&Answers more detail:os