I'm trying to prevent syslog from logging an error message each time a successful once-a-minute cron job runs. I've followed the advice in this post:
and set my 'cronloglevel' to '9' so that only errors should be printed. However, I'm still seeing the following printed in my logs each time the job runs, which makes me think that crond is seeing my job as erroring:
Fri Dec 1 15:33:00 2023 cron.err crond[1992]: USER root pid 25046 cmd /usr/sbin/test.sh
Here are the contents of that script:
#!/bin/sh
uptime >> /tmp/uptime.log
And I verified it is producing output:
# tail /tmp/uptime.log
15:25:00 up 3 days, 18:50, load average: 0.12, 0.19, 0.17
15:26:00 up 3 days, 18:51, load average: 0.10, 0.17, 0.17
15:27:00 up 3 days, 18:52, load average: 0.30, 0.22, 0.18
15:28:00 up 3 days, 18:53, load average: 0.10, 0.18, 0.17
15:29:00 up 3 days, 18:54, load average: 0.10, 0.16, 0.16
15:30:00 up 3 days, 18:55, load average: 0.11, 0.16, 0.16
15:31:00 up 3 days, 18:56, load average: 0.09, 0.14, 0.16
15:32:00 up 3 days, 18:57, load average: 0.31, 0.21, 0.18
15:33:00 up 3 days, 18:58, load average: 0.22, 0.21, 0.18
15:34:00 up 3 days, 18:59, load average: 0.23, 0.23, 0.19
The job is running successfully, but I can see from the log message that this is being logged as an error ("cron.err"). Is this because there is some indicator that crond requires to consider the job "successful" and I'm not providing it? If so, what does my script need to do? If not, is there any other way to prevent crond from treating my job as erroring and logging it as such?