I have a purge job that runs daily to clean up logs older than 30 days.
find /dir/app/logs -mtime +30 -exec rm -f {} \;
I am moving our jobs out of cron and into a 3rd party scheduling product, Automic. Since moving this job, I keep getting the error "No such file or directory" randomly. Running the find command at the prompt after receiving the error, without the -exec rm -f {} \;, always returns no results and runs successfully. Long story short, I'm unable to reproduce the error.
The job runs by executing the command:
ssh user@server "find /dir/app/logs -mtime +30 -exec rm -f {} \;"
against the remote server.
I have tested various solutions without any luck. Originally, the command ran without -f. Adding -f, I understand, is supposed to suppress errors, but I'm not seeing that happen. I tried replacing -exec rm {} \; with -delete, but that didn't help either.
Currently I'm testing changing \; to + as suggested here:
Thanks in advance for any insight into what's going on.