What's new

cru not using sytem date

  • SNBForums Code of Conduct

    SNBForums is a community for everyone, no matter what their level of experience.

    Please be tolerant and patient of others, especially newcomers. We are all here to share and learn!

    The rules are simple: Be patient, be nice, be helpful or be gone!

Frejoh4666

Occasional Visitor
So it is summer time in the US, but not in EU.

I have set the summer time to last Sunday in the month. The system time in the web gui shows 6:00, SSH "date" says 6:00, cru think it is 7:00. Does cru have it own time settings with summer time? Can I make cru use system time?
 
Restarting the router solved the problem, but I need to find why cru did not go by system time, and how it knew US had DST when I had EU DST selected. As it probably will be a problem in a few weeks when EU change to DST.
 
I don't understand what you are describing. You said your router was configured for the EU timezone. So what is the relevance of mentioning "US". If the router was configured for a US timezone the system time would be something like 4 to 8 hours different, not 1 hour.

cru is just a command that manipulates the crontab used by crond.

I tested this on my router by rolling the date and time forward and it worked as expected:
Code:
Mar 12 02:59:18 crond[1595]: time disparity of -718 minutes detected
Mar 12 03:00:00 admin: cron thinks its 3am
Mar 31 00:59:39 crond[1595]: time disparity of 27238 minutes detected
Mar 31 02:00:15 watchdog: restart_firewall due DST time changed(0->1)
Mar 31 03:00:00 admin: cron thinks its 3am
 
Last edited:
Sorry, I will try to be clearer on what happened.

I have a cru command "cru a start "55 4 * * 0,1,2,3,4,5,6"" so it starts at 4:55 every day. At 2024-03-10 it started at 3:55. That is the time US changes to DST. My router was not on US DST, so it should not have started at 3:55, it should have started 4:55. The router said the time was correct, so the router time was not on US DST, but the cru command started at 3:55.

So the router System date said it was 3:55 and the cru was supposed to start at 4:55. but the cru command was started at 3:55, an hour earlier then it was suppose to.

At 3:55 the "cru a start "55 4 * * 0,1,2,3,4,5,6"" started, and the ssh command "date" gave the correct time. I solved it by restarting the router. But I don't know why it started an hour early, as the DST was set to the EU, and system time was correct.
 
Were the timezone DST values previously set incorrectly in the GUI and then you updated them but didn't reboot the router? That's the only scenario I can think of that would explain what happened.
 
Were the timezone DST values previously set incorrectly in the GUI and then you updated them but didn't reboot the router? That's the only scenario I can think of that would explain what happened.
I have confirmed this behaviour.

@RMerlin This looks like a long standing oversight. crond uses the TZ setting from when it starts up. Changing the DST settings in the GUI does not restart crond therefore it continues to use the old TZ settings. So in addition to the GUI doing a restart_time it needs to do a restart_crond.
 
Were the timezone DST values previously set incorrectly in the GUI and then you updated them but didn't reboot the router? That's the only scenario I can think of that would explain what happened.

It was 108 days ago the last time it was restarted, and the default is US DST, so I can't say for sure (was a factory reset, used VPN and a bug made nvram full). But what you say make sense, so the problem should be solved then. I will know in a few weeks, and for sure in half a year.
 
Last edited:
@RMerlin I see you have updated the 386_x branch with this fix. But I believe the same also needs to be applied to the master branch which is what I was testing with.
 
@RMerlin I see you have updated the 386_x branch with this fix. But I believe the same also needs to be applied to the master branch which is what I was testing with.
That was already merged in master, in fact Dave's PR was against the Master branch, so that was merged first.
 
That was already merged in master, in fact Dave's PR was against the Master branch, so that was merged first.
He’s asking about the commit restarting crond when restart_time runs. ;)
 
He’s asking about the commit restarting crond when restart_time runs. ;)
Gotcha. I might have forgotten to cherry-pick that one since my development night ended prematurely as my laptop broke on me.
 

Similar threads

Latest threads

Sign Up For SNBForums Daily Digest

Get an update of what's new every day delivered to your mailbox. Sign up here!
Top