Let's reposition the redirections a bit and add some line breaks to see what you're actually running:
>> /home/things/logs/backup.log \
>> /home/things/logs/backup.log \
find /home/things/backups -mtime +0 -exec echo "{}" \; \
-exec echo "Hourly rotate successful: $(date). {} was deleted.";
\;
You're redirecting find
's output, not that of the commands run by -exec
. This would affect the commands run using -exec
since they are child processes and inherit open file descriptors, so the effect would be what you needed even if the way you went about it was weird.
Then the ;
at the end of the second exec
wasn't escaped. The find
command got terminated there without a ;
for exec
, causing the error. find
quit immediately because of this, so no output was produced.
The \;
at the end is then processed by the shell. Usually, it would be a statement delimiter, but since it is escaped, it tries to run it as a command. This fails, naturally.
Consider simplifying the command:
find /home/things/backups -mtime +0 -exec \
bash -c 'printf "%s\nHourly rotate successful: $(date). %s was deleted.\n" "$0" "$0"' {} \; \
>> /home/things/logs/backup.log