Cron jobs not working: "cron.err crond"

Hello, my cron job is not working:
in http://192.168.1.1/cgi-bin/luci/admin/status/logs (syslog):

Tue Aug 15 15:23:00 2023 cron.err crond[1510]: USER root pid 4568 cmd /usr/bin/wireguard_watchdog
Tue Aug 15 15:24:00 2023 cron.err crond[1510]: USER root pid 4587 cmd /usr/bin/wireguard_watchdog
Tue Aug 15 15:25:00 2023 cron.err crond[1510]: USER root pid 4605 cmd /usr/bin/wireguard_watchdog
Tue Aug 15 15:26:00 2023 cron.err crond[1510]: USER root pid 4623 cmd /usr/bin/wireguard_watchdog
Tue Aug 15 15:27:00 2023 cron.err crond[1510]: USER root pid 4641 cmd /usr/bin/wireguard_watchdog

running multiple times
root@wdr3500:~# /usr/bin/wireguard_watchdog
does not create any entrys in syslog

root@wdr3500:~# cat /etc/crontabs/root
* * * * * /usr/bin/wireguard_watchdog

I have searched in this forum but still not be able to understand what the problem is. Expected behavior: cron gives not such errors in syslog. There are much threads about such an error. I could not figure out, what this means and how to solve. So I ask u directly.

root@wdr3500:~# ls -la /usr/bin/*
snip
lrwxrwxrwx    1 root     root            17 Apr 27 22:28 /usr/bin/wc -> ../../bin/busybox
-rwxr-xr-x    1 root     root         42037 Feb  8  2022 /usr/bin/wg
lrwxrwxrwx    1 root     root            18 Apr 27 22:28 /usr/bin/wget -> /bin/uclient-fetch
lrwxrwxrwx    1 root     root            17 Apr 27 22:28 /usr/bin/which -> ../../bin/busybox
-rwxr-xr-x    1 root     root          2780 Feb  8  2022 /usr/bin/wireguard_watchdog
lrwxrwxrwx    1 root     root            17 Apr 27 22:28 /usr/bin/xargs -> ../../bin/busybox
snip
root@wdr3500:~# crontab -l
* * * * * /usr/bin/wireguard_watchdog

I have added a own logger command into the wireguard_watchdog file:

root@wdr3500:~# cat /usr/bin/wireguard_watchdog | grep logger
  logger -t "wireguard_monitor" "${iface} endpoint ${endpoint_host}:${endpoint_port} is not responding for ${idle_seconds} seconds, trying to re-resolve hostname"
  logger -t "wireguard_monitor" Monitor checked for wg-health. Ok...

Now get this every minute:

Tue Aug 15 15:48:00 2023 cron.err crond[5174]: USER root pid 5334 cmd /usr/bin/wireguard_watchdog
Tue Aug 15 15:48:00 2023 **user.notice wireguard_monitor: Monitor checked for wg-health. Ok...**
Tue Aug 15 15:49:00 2023 cron.err crond[5174]: USER root pid 5355 cmd /usr/bin/wireguard_watchdog
Tue Aug 15 15:49:00 2023 **user.notice wireguard_monitor: Monitor checked for wg-health. Ok...**
root@wdr3500:~# ps w | grep cron
5174 root      1312 S    /usr/sbin/crond -f -c /etc/crontabs -l 5
5474 root      1308 S    grep cron

For reference the user guide is here: https://openwrt.org/docs/guide-user/base-system/cron

What does cron.err crond[5174] or cron.err crond[1510] mean and how to fix it? Also the wireguard_watchdog does not seem to work in my case, because I use only IPs in wireguard config, so there is no hostname to resolve (IPs are skiped), source code:

Can we solve also the IPs skipped problem or should I open a new thread for for every detail? Thank you very much.

you can lower the log values

edit /etc/config/system

option conloglevel '4'
option cronloglevel '9'

view:

wireguard_watchdog

not work ...

view:

I did this:
root@wdr3500:~# nano /etc/config/system


#       option conloglevel '8'
#       option cronloglevel '5'
        option conloglevel '4'
        option cronloglevel '9'

and saved, then:
root@wdr3500:~# /etc/init.d/cron restart

Waiting 1-2 Min and watching into: http://192.168.1.1/cgi-bin/luci/admin/status/logs

You helped to surpress this cron.err crond[PID]: error. Cron does not produce such errors now. Thank you!

1 Like

the errors (they are still there) you simply told it to avoid logging them above a certain threshold

I didn't see an issue in your first post.

You stated:

This shows that your cron job is running every minute, as it seems you discussed here: Wireguard on a Router - never ending reboots after adding "watchdog" in Crontab

Running this on the command line would not make a log entry. It's not clear why you're under the impression that it should make a log entry - can you explain?

It means your cron job ran successfully. :wink:

It's not clear why you're doing this and what the issue is that you're solving by doing so.

Not sure how those configs are related to the cron job you configured - or how it relates to running the the wireguard watchdog command. Perhaps there's some confusion on your part?

2 Likes

Thank you for give me some hints. "cron.err crond" the err indicates a short for error, this means something went wrong. And with your help I trie to figure out why syslog is not clean from errors. Now its surpressed and not showing anymore. When I add costum logger into watchdog then I want better understand how and if it is working and what syslog events it produces.

Still could not find out what err means after reading this: https://openwrt.org/docs/guide-user/base-system/cron and this: https://man.cx/crontab(1) and this: https://www.adminschoice.com/crontab-quick-reference (because the phrase "err" or "cron.err" is not present in this references. So maybe something about logging https://openwrt.org/docs/guide-user/perf_and_log/log.messages give a answer on what cron.err means.

Thank u i have viewed.

Trying figuring out what the problem is makes me doing things to be able to understand better and tell you the responses to be able to get better insights. Sometimes, there is no problem, so this is explanation I can you in the moment.

So cron.err crond and many peoples with the same logs have to read err as "success", okay :slight_smile: Also I am sorry for english that is not perfect.

Here's more information on why it says "err":

Since I am using BusyBox v1.35.0 in OpenWrt 22.03.5, r20134-5f15225c1e this means, bug still not fixed and all syslog messages from BusyBox components like cron in this case cant produce Error Level like NOTICE or INFO, all will be err = error. so i have to go back to standard cronloglevel, okay, thank you.

   option conloglevel '8'
   option cronloglevel '5'
#        option conloglevel '4'
#        option cronloglevel '9'

I'm confused, what bug?

Did you mean to change cronloglevel to 0?

as i told you you only suppressed the errors (which are not really errors), the choice of the log level is only your choice ....

if you made a script that just touch a file even then you'd get a similar error...

It's just choices you have to make...

echo "touch /tmp/my_file" > /root/bin/test
echo "* * * * * /root/bin/test" >> /etc/crontabs/root
/etc/init.d/cron restart
1 Like

The bug that makes this:


config BUSYBOX_DEFAULT_FEATURE_SYSLOG_INFO
	bool
	default n

Resulting in messages from cron and maybe other busybox deamons all give a error instead of notice or info. The reason is to "save memory".

1 Like

Correct, this means it's working as intended by design and not a bug. Thanks for providing the clarification.

3 Likes

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