What's new

Cron job and DST is wrong

  • 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
On Sunday everything happened 1 hour early and took a few moments to find out why. It is DST in US.

So I changed the settings on the router to EU DST.
Code:
DST time zone changes starts   3 month     5th Sun Week & days   2 hours 
DST time zone changes ends  10 month     5th Sun Week & days  2 hours

Called it a day, but on Monday same thing, one hour early. So I check the log and find that the system time is right, and the log timestamp is right, yet it sent it an hour earlier. And got a bunch of "crond[288]: user frejoh466: parse error at 6,7", from "cru a WoL2 "15 7 * * 6,7 [command]" I split it to 6 and 7, and is now only getting error at 7. I believe 0 and 7 is sunday, so I changed it to 0 and not getting any error. But it did work before DST change.

Here is the crontab I have
Code:
frejoh466@RT-N66U-B308:/tmp/home/root# cru l
45 5 * * 1,2,3,4,5 [command] #WoL#
00 2 * * Mon sh /opt/share/diversion/file/update-bf.div reset #Diversion_UpdateBF#
20 5 * * * sh /opt/share/diversion/file/rotate-logs.div #Diversion_RotateLogs#
20 17 * * * diversion count_ads count #Diversion_CountAds#
15 7 * * 7 [command] #WoL2#
15 7 * * 0 [command] #WoL3#

And here is the log, at 6:33 I logged in and looked at system time.
Code:
Mar 12 00:14:00 crond[288]: user frejoh466: parse error at 7
Mar 12 01:14:00 crond[288]: user frejoh466: parse error at 7
Mar 12 02:14:00 crond[288]: user frejoh466: parse error at 7
Mar 12 03:14:00 crond[288]: user frejoh466: parse error at 7
Mar 12 04:14:00 crond[288]: user frejoh466: parse error at 7
Mar 12 05:14:00 crond[288]: user frejoh466: parse error at 7
Mar 12 05:20:00 crond[288]: USER frejoh466 pid 6724 cmd sh /opt/share/diversion/file/rotate-logs.div
Mar 12 05:20:02 Diversion: rotated dnsmasq log files, from /opt/share/diversion/file/rotate-logs.div
Mar 12 05:45:00 crond[288]: USER frejoh466 pid 6874 cmd [command]
Mar 12 06:13:00 crond[288]: user frejoh466: parse error at 7
Mar 12 07:13:00 crond[288]: user frejoh466: parse error at 7
Mar 12 07:15:00 crond[288]: USER frejoh466 pid 7010 cmd [command]
Mar 12 06:33:47 rc_service: httpd 286:notify_rc restart_time;restart_upnp;
Mar 12 06:33:47 dropbear[6535]: Early exit: Terminated by signal
Mar 12 06:33:47 syslogd exiting
Mar 12 06:33:47 syslogd started: BusyBox v1.25.1
Mar 12 06:33:47 kernel: klogd started: BusyBox v1.25.1 (2018-04-08 14:03:19 EDT)
Mar 12 06:33:47 start_nat_rules: apply the nat_rules(/tmp/nat_rules_eth0_eth0)!
Mar 12 06:33:48 dropbear[7061]: Running in background
Mar 12 06:33:48 hour_monitor: daemon is starting
Mar 12 06:33:48 hour_monitor: daemon terminates
Mar 12 06:33:48 miniupnpd[7083]: HTTP listening on port 37650
Mar 12 06:33:48 miniupnpd[7083]: Listening for NAT-PMP/PCP traffic on port 5351
Mar 12 06:49:13 miniupnpd[7083]: remove port mapping 4951 UDP because it has expired
Mar 12 06:49:13 miniupnpd[7083]: remove port mapping 4956 UDP because it has expired
Mar 12 07:17:51 dropbear[7142]: Child connection from 192.168.1.64:xxx
Mar 12 07:17:56 dropbear[7142]: Password auth succeeded for 'frejoh466' from 192.168.1.64:xxx

The log says it send the command 05:45:00, but it did not. I received the command 04:45:00. So it send the command at 04:45:00 and then log it at 05:45:00 (so system time is wrong). I also got the command that is only supposed to activate on Sat,Sun, 07:15:00, might be the new error with the 7.

And today same thing happened

Code:
frejoh466@RT-N66U-B308:/tmp/home/root# cru l
45 5 * * 1,2,3,4,5 ether-wake -i br0 [command] #WoL#
00 2 * * Mon sh /opt/share/diversion/file/update-bf.div reset #Diversion_UpdateBF#
20 5 * * * sh /opt/share/diversion/file/rotate-logs.div #Diversion_RotateLogs#
20 17 * * * diversion count_ads count #Diversion_CountAds#
15 7 * * 6 [command] #WoL3#
15 7 * * 0 [command] #WoL2
frejoh466@RT-N66U-B308:/tmp/home/root#

Code:
Mar 13 05:20:00 crond[288]: USER frejoh466 pid 9183 cmd sh /opt/share/diversion/file/rotate-logs.div
Mar 13 05:20:02 Diversion: rotated dnsmasq log files, from /opt/share/diversion/file/rotate-logs.div
Mar 13 05:45:00 crond[288]: USER frejoh466 pid 9331 cmd [command]
Mar 13 06:17:31 dropbear[9860]: Child connection from 192.168.1.64:xxx
Mar 13 06:17:36 dropbear[9860]: Password auth succeeded for 'frejoh466' from 192.168.1.64:xxx
Mar 13 06:19:01 dropbear[9860]: Exit (frejoh466): Exited normally
Mar 13 06:48:58 miniupnpd[7476]: remove port mapping 4951 UDP because it has expired
Mar 13 06:48:58 miniupnpd[7476]: remove port mapping 4956 UDP because it has expired

I logged in around 04:50:00 after it had executed the 05:45:00 command, and the system time says 04:50:00. At 06:17:36 I connected with SSH and added test cronjobs, 7:10, 8:15, 9:20 at 8:00 it only trigger the 08:15:00.

So I guess at 00:00 the system use US DST, and think that 00:00 is 01:00. And when I login in it updates the time to the way I set it.

I'm not sure how to fix this. Anyone got a clue?
Using ASUS Merlin Firmware:380.70
 
Last edited:
why would you be setting DST on the same month & same day though?
is it to remove dst completely?
I will probably try to offset an hour / a day to see it works
 
Last edited:
that's what it looks like when i try to select the same time zone as you
dst.png

maybe give that a try

assuming asus implement it correctly ( even though they f*ck up the DST for EST :()
 
Last edited by a moderator:
What router are you using? Some daylight saving offsets were fixed in a later firmware if you are using a presently supported version
 
So I guess at 00:00 the system use US DST, and think that 00:00 is 01:00. And when I login in it updates the time to the way I set it.

I'm not sure how to fix this. Anyone got a clue?
Using ASUS Merlin Firmware:380.70
Did you reboot the router after changing the timezone settings for DST? Minimally you may want to restart cron.
Code:
service restart_crond
 
I too seem to remember a newer firmware than what you're running correcting the time system.

Maybe time to upgrade to john9527's LTS fork which is newer than what you're currently running.
 
I changed the timezone to +2 and the system clock is now 1 hour after my real time. It works, but not sure what will happen on the 5'th Sunday.
 
I changed the timezone to +2 and the system clock is now 1 hour after my real time. It works, but not sure what will happen on the 5'th Sunday.
5th sunday is LAST sunday of month (I tested it), they only dont care and correct wording!
 
Would you please post the output of these commands?
Code:
nvram show | grep zone
cat /etc/TZ
date

I changed the settings to my real settings, https://i.imgur.com/PWaNeCM.jpg and used the command.
Code:
frejoh466@RT-N66U-B308:/tmp/home/root# nvram show | grep zone
time_zone_dst=1
time_zone_x=MET-1DST,M3.5.0/2,M10.5.0/2
time_zone_dstoff=M3.5.0/2,M10.5.0/2
time_zone=MET-1DST
size: 52185 bytes (13351 left)
frejoh466@RT-N66U-B308:/tmp/home/root# cat /etc/TZ
MET-1DST,M3.5.0/2,M10.5.0/2
frejoh466@RT-N66U-B308:/tmp/home/root# date
Fri Mar 15 16:14:21 MET 2019
frejoh466@RT-N66U-B308:/tmp/home/root#


5th sunday is LAST sunday of month (I tested it), they only dont care and correct wording!

Yes, I'm aware. It takes the 5'th Sunday or the last Sunday in the month. But it still shouldn't change the time the first Sunday of the month and only update to the correct time if I login after 00:00.
 

Similar threads

Latest threads

Support SNBForums w/ Amazon

If you'd like to support SNBForums, just use this link and buy anything on Amazon. Thanks!

Sign Up For SNBForums Daily Digest

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

Members online

Top