I am fighting with a cronjob which does not work. Everytime when it is executed it get an error-mail saying
/bin/sh: -c: line 0: unexpected EOF while looking for matching `"'
/bin/sh: -c: line 1: syntax error: unexpected end of file
My crontab is this one:
# Delete logfile from last week
00 21 * * * rm /var/log/dumping_$(date -d @$(( $(date "+%s") + 86400 )) "+%u").log
I tried several options, e.g.
00 21 * * * 'rm /var/log/dumping_$(date -d @$(( $(date "+%s") + 86400 )) "+%u").log'
00 21 * * * /bin/bash -c 'rm /var/log/dumping_$(date -d @$(( $(date "+%s") + 86400 )) "+%u").log'
None of them worked as cronjob. Of course, it is working when I enter it on command-line directly. What would be the correct syntax?