I have backup script for Mysql that previously ran using CRON without issue. I migrated to using systemd timer. The script starts out deleting the previous weeks files before the copy, using this command;

find /home/NAS2/$SRVER/backups/$_DAY -type f -exec rm {} \;

What I get in messages log is this;

percona_backup: rm: cannot remove ‘/home/NAS2/o71/backups/Monday/mysql/proc.ibd’: No such file or directory

SELinux is set to enforced. I should mention, there are 3 servers running variation of the same script, only 2 are failing with this error. All comes down to this one command.

So, why would this work as CRON but fail with systemd timer? Why would it work on 1, but same command fail on 2 other servers?

  • You may somehow be starting the same backup twice, simultaneously. Perhaps the cron setup is still configured? – meuh Oct 3 '16 at 13:50
  • That was the first thing I thought of, and verified the cron job was not running. – Sean W Oct 3 '16 at 14:56

If you don't care about the failure to remove files that have already been removed, then you can add the --force option to rm. From the man rm docs:

ignore nonexistent files and arguments, never prompt

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.