I'm a little confused. I have a download directory that I want to remove all files older then 30 days with tmpreaper. Just one problem, the directory in question is a separate partition with a lost+found directory, of course I need to keep it so I added --protect 'lost+found'
, the problem is that tmpreaper outputs:
error: chdir() to directory 'lost+found' (inode 11) failed: Permission denied
(PID 30604) Back from recursing down `lost+found'.
Entry matching `--protect' pattern skipped. `lost+found'
I have tried with other pattern like lost* and so on... I'm running tmpreaper as a non-root user because there is no reason for superuser privileges because I own all files (except lost+found).
Are I'm forced to run tmpreaper as root? Or are my shell-skills not as good as I thought? I guess the problem is:
tmpreaper will chdir(2) into each of the directories you've
specified for cleanup, and check for files matching the
<shell_pattern> there. It then builds a list of them, and
uses that to protect them from removal.
Any thought and/or advice?
The command I'm trying to run is something like
$ /usr/sbin/tmpreaper -t --protect 'lost+found' 30d /mydir 1> /dev/null
error: chdir() to directory `lost+found' (inode 11) failed: Permission denied
Edit:
Redmumba noticed that the return code is still zero, and the files are removed. I must have had some other issues before because nothing was removed when I wrote this post. Anyway it's working now, Thanks.