Hello everyone, when my cron jobs are executed I see the following error messages in the syslog.
Fri Aug 9 11:20:59 2024 cron.err crond[22619]: crond (busybox 1.36.1) started, log level 8
Fri Aug 9 11:20:59 2024 cron.err crond[22619]: user root: parse error at 7
Fri Aug 9 11:21:00 2024 cron.err crond[22619]: user root: parse error at 7
Fri Aug 9 11:21:00 2024 cron.err crond[22619]: USER root pid 22644 cmd php-cli -q /etc/fail2ban/cron2ban.php
Here is my config file.
*/1 * * * * php-cli -q /etc/fail2ban/cron2ban.php
5 1 * * 0 sh /etc/config/backup.sh
10 1 * * 0 reboot
30 21 1-7 1-12 7 opkg list-installed > /etc/config/my_installed_packages
But the commands are executed.
Do you have any tips as to why I see these error messages in the syslog?
Greetings from Stefan
sharbich:
parse error at 7
That is to be taken very literally: the "7" does not parse, and I would guess it's the not-actually-standard-but-supported-in-many-cron-implementations "7" for Sunday. Try "0" instead.
2 Likes
That was exactly the error. Changing it to "0" for Sunday made the error go away. Now the error in the php-cli script remains.
you mean the error you haven't posted ?
My bad, I thought there was something you hadn't posted, sorry.
That's not an actual error, but a log entry.
That is a quirk: cron uses a log function in busybox that has no input for error levels and is fixed to log everything as an "error." Consequently every log entry by cron will be tagged cron.err, whether it is an actual error or not.
What you can do, however, is set cron itself to a different error level, it will internally decide what to send to the log -- see the cronloglevel option in /etc/config/system. Personally I set it to 9, so it will really only send actual errors.
2 Likes
sharbich:
This is the solution.
Then mark it as solution, not you saying "this is the solution". Not out of a desire to collect "solution points", but for the benefit of other people looking for the solution.
3 Likes