Cron.err - why?

I have the following crontab. It executes the jobs in it, but it is filling the system log with cron.err messages.

crontab, edited with crontab -e

# Once a year, refresh the SSL certificates
0 0 1 */12 * /usr/bin/refresh_ssl_certificates.sh

# This script works fine if I just execute it from the terminal
*/1 * * * * /usr/bin/test.sh
# Debug with the simplest possible command
*/1 * * * * echo "hello"

And yet, in logread it is full of these errors. What is it trying to tell me?

Tue Jul  7 14:07:35 2020 cron.err crond[8795]: crond (busybox 1.31.0) started, log level 5
Tue Jul  7 14:08:00 2020 cron.err crond[8795]: USER root pid 9035 cmd /usr/bin/test.sh
Tue Jul  7 14:08:00 2020 cron.err crond[8795]: USER root pid 9036 cmd echo "hello"
Tue Jul  7 14:09:00 2020 cron.err crond[8795]: USER root pid 9573 cmd /usr/bin/test.sh
Tue Jul  7 14:09:00 2020 cron.err crond[8795]: USER root pid 9574 cmd echo "hello"
Tue Jul  7 14:10:00 2020 cron.err crond[8795]: USER root pid 10107 cmd /usr/bin/test.sh
Tue Jul  7 14:10:00 2020 cron.err crond[8795]: USER root pid 10108 cmd echo "hello"
Tue Jul  7 14:10:40 2020 user.notice INFO: test.sh your debug script ran

Please do not let the last line mislead you into thinking the test.sh was not running successfully before; I only added that logger in later to confirm that the script is running.

Limitation of busybox cron

No way to fix it at all? I even put the cron log level at 9 but it still shows.

No, it is hardcoded in the crond.c sources.

1 Like

I think I found the line you are referring to, on line [958 here].
I guess I can try patching it so that line is removed just for testing.
(https://git.busybox.net/busybox/tree/miscutils/crond.c)

			log8("USER %s pid %3d cmd %s",

Looking into it further, setting log level of 9 probably did not make any difference, as it only has support for 5, 8 and 9 (possible bug on level 5, as it is actually set to 4). This is on lines 188 to 210.

I might be able to make some improvements here in the form of a patch by implementing support for a higher log level.

The FEATURE_SYSLOG_INFO option appeared in BusyBox v. 1.31.0. But in OpenWRT in order to save memory :slight_smile: this option is disabled by default: master, openwrt-21.02 branch. As a result, BusyBox components (including cron) in syslog write all messages with the error level.

2 Likes