PLEASE NOTE: I have read all the similar questions re. cron, paths, env variables and so on, but have found none that offer solutions to my particular problem.
I have a script that makes some MySQL dumps and then deletes old ones like this:
/usr/bin/find "/home/bkp/dbdump" -name "*.gz" -mtime +5 -delete
(above command has been modified from my original command by suggestions from comments)
However, the files are never deleted when cron runs this script. The cron user is root.
Debugging notes
If I manually run the script in which the command appears, it deletes them as expected.
If I run the above find command on its own from the command line as root, it deletes them as expected (and with -print it returns a list of files older than 5 days as expected)
I have also added an explicit path statement to root's crontab, but
that doesn't change anything.Cron sends no error, and if I pipe the find operation to a log file,
that comes up empty or is not created at all.I'm using Ubuntu server 14.04.03 LTS.
/usr/bin/find /home/bkp/dbdump/*.gz -mtime +5
cron
commands are run through the shell, and the shell expands wildcards.cron
should send email with output and error messages. Do you get any such email from this job?