Skip to content
Contents
GuidesOpenWrt

How to change the OpenWrt cron log level and verify a scheduled job ran

From the cronloglevel in system, retrieve the actual parameters passed from procd to crond, then verify the job execution using a dedicated task marker.

If a task is not visible in the logs, first separate the logs of the scheduler messages from the output of the commands themselves. The log level of crond affects what the scheduler records; to prove that a script reached a specific step, the clearest approach is to write a distinct marker at that location for easy search.

How does the local boot script pass parameters?

In a router's wired SSH session, read current settings, startup scripts, and processes:

uci -q get 'system.@system[0].cronloglevel'
grep -nE 'cronloglevel|procd_set_param command' /etc/init.d/cron
ps w | grep '[c]rond'
crontab -l

The OpenWrt startup script reads a non-negative integer from system.@system[0].cronloglevel, passing it to BusyBox crond via the -l option; if no value is set, the script passes 7. When the first line has no output, inspect the second and third lines to confirm the local fallback value and actual parameters. If no processes are running, additionally verify whether a task schedule exists: the script exits if the /etc/crontabs directory is empty. Other cron implementations or custom firmware follow this local script's behavior.

Temporarily adjust the detail level of crond

First run uci changes system, and address any pending changes before proceeding. Note the original value or "not set", then verify the supported levels on this device using crond --help. Then, during a maintenance window, test a more detailed level, such as 5:

uci set 'system.@system[0].cronloglevel=5'
uci commit system
/etc/init.d/cron restart
ps w | grep '[c]rond'

Process parameters should include -l 5. If the local service fails to start, immediately restore the previous value; if no value was originally set, execute uci -q delete 'system.@system[0].cronloglevel'. After submitting the system configuration, restart cron and check the process again.

Use a short task to verify, then restore original settings.

Before making adjustments, note the original values and whether this UCI option existed initially. Verify the level meanings using crond --help on the device; in BusyBox, smaller numeric values typically indicate more detailed output. Temporarily add a line to "System → Scheduled Tasks": * * * * * /usr/bin/logger -t gm-cron-check ran; first verify the path with command -v logger. Save and confirm that cron has reloaded the task table. Wait until past the next full minute, then run logread -e gm-cron-check.

Find a marker that proves this command was executed. If only the crond startup log is present and no marker exists, verify the system time and confirm whether the task appears in root's task list, and ensure the command uses the correct absolute path. If the diagnostic log level was changed, restore the original level; if the machine originally did not have this option, remove the newly added option. Have the service reload its configuration, remove this test task, and retain all other scheduled tasks.

Reference

Related guide · Can't save the adblock-fast update schedule in LuCI? Check the cron entry

Explore hardware

Comments