Cron.err crond[1238] - in system log

I am running 24.10.0 on Raspberry Pi 4B.
My logging configuration in Luci as below,

I have custom shell script as below,

root@OpenWrt:~# cat custom_node_exporter_metrics.sh
#!/bin/sh
> /var/lib/node_exporter/textfile_collector/custom_node_exporter_metrics.sh.prom

# Example: Get the current system uptime in seconds
link_speed=$(cat /sys/class/net/eth0/speed)
uptime_seconds=$(cat /proc/uptime | awk '{print $1}')
rx_bytes=$(awk '/eth1/ {print $2}' /proc/net/dev)
tx_bytes=$(awk '/eth1/ {print $10}' /proc/net/dev)
echo "custom_link_speed{job=\"node\"} ${link_speed}" >> /var/lib/node_exporter/textfile_collector/custom_node_exporter_metrics.sh.prom
echo "custom_uptime_seconds{job=\"node\"} ${uptime_seconds}" >> /var/lib/node_exporter/textfile_collector/custom_node_exporter_metrics.sh.prom
echo "custom_rx_bytes{job=\"node\"} ${rx_bytes}" >> /var/lib/node_exporter/textfile_collector/custom_node_exporter_metrics.sh.prom
echo "custom_tx_bytes{job=\"node\"} ${tx_bytes}" >> /var/lib/node_exporter/textfile_collector/custom_node_exporter_metrics.sh.prom

And a cron schedule as below,

root@OpenWrt:~# crontab -l
@reboot /root/ddns.sh >> /root/ddns.log
#*/5 * * * * /root/ddns.sh >> /root/ddns.log
#*/1 * * * * /root/link_speed.sh
*/1 * * * * /root/custom_node_exporter_metrics.sh

root@OpenWrt:~#

And it works. I can see that every minute, /var/lib/node_exporter/textfile_collector/custom_node_exporter_metrics.sh.prom file is getting updated.

However, in Luci when I check every minute there is entry like below,

Sat Feb 22 09:38:00 2025 cron.err crond[1238]: USER root pid 19643 cmd /root/custom_node_exporter_metrics.sh

How can I know what is the error and how to fix it? Like I said cron works without issue.
Also why this error is being logged, when I have Cron logging Level set as disabled?

There's no error.

1 Like

Is there a way I can make cron STOP writing logs to syslog?

Just curious, does this entry work for you?

I'll let someone else answer more in depth. I noticed you edited.

2 Likes

yes @reboot works

1 Like

cat /etc/config/system | grep cronloglevel Might need a change.

I already have 9

root@OpenWrt:~# cat /etc/config/system | grep cronloglevel
        option cronloglevel '9'
root@OpenWrt:~#

Should I comment that option and restart cron?

#option cronloglevel '9'

update: Tried commenting cronloglevel and did /etc/init.d/cron restart still cron.err entries are being logged in syslog.

Commenting out the option in config file causes the built-in default value 7 to kick in, and there is logging.

9 should quieten it.

3 Likes

That worked. I put 9 back and restarted cron. Now no "cron.err crond" in system log.
I don't know why it was not working initially. It was already 9

Should I leave below as it is?

If it now works as you wish, just leave the current settings there...

1 Like

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.