Error in crontab file: bad day-of-week
When I run crontab -e
on my Debian server and add these lines:
# System statistics
*/10 * * * * /usr/lib/sysstat/sa1 1 1 > /dev/null 2>&1
59 23 * * * /usr/lib/sysstat/sa2 -A > /dev/null 2>&1
after save, the crontab complains:
crontab: installing new crontab
"/tmp/crontab.xSbhwZ/crontab":30: bad day-of-week
errors in crontab file, can't install.
This is line 30: */10 * * * * /usr/lib/sysstat/sa1 1 1 > /dev/null 2>&1
. When I comment this line, it's all fine.
Any thoughts?
Ok, so the problem was "non-breaking" space inserted from OSX (alt+space) between the * instead of regular space – Petr Nagy May 19 '16 at 17:57
Add that as an answer so that it's obvious that the question has been answered. – wurtel May 20 '16 at 7:05
I had the same error,although the bad space was not entered by OSX but by some gremlin. I fixed the problem by pulling the crontab into a file
crontab -l > crontab.txt
And then replacing all the 'spaces' in the file with true spaces. I then pulled that text file back into the crontab :
crontab crontab.txt