[Bug 1080490] New: /usr/lib/cron/run-crons miscalculates cron.daily triggers
http://bugzilla.opensuse.org/show_bug.cgi?id=1080490 Bug ID: 1080490 Summary: /usr/lib/cron/run-crons miscalculates cron.daily triggers Classification: openSUSE Product: openSUSE Tumbleweed Version: Current Hardware: Other OS: Other Status: NEW Severity: Normal Priority: P5 - None Component: Basesystem Assignee: bnc-team-screening@forge.provo.novell.com Reporter: Stromeko@NexGo.DE QA Contact: qa-bugs@suse.de Found By: --- Blocker: --- The part of the script that tries to figure out if it should run the cron.daily scripts miscalculates the condition for find. Instead of finding scripts that were not run yet today, it looks for scripts that were not run in the last 24 hours. If for whatever reason your cron.daily was run 23:59 yesterday, it will not run today. The correct way to deal with this is to either calculate how many minutes we are into the current day and run anything older than that again (similar to what cron.monthly is doing) or drop a cookie with 'touch -d "today 0:00" cookie' and run if not newer than that (TIME="-not -newer cookie"). Making that safe using mkstemp is left as an exercise for the reader. The cron.weekly section suffers from the same problem, but it's probably hard to notice. The cron.monthly section would probably get easier with the cookie file method as well. It is currently also making the mistake of dragging the current time of day into the result. -- You are receiving this mail because: You are on the CC list for the bug.
http://bugzilla.opensuse.org/show_bug.cgi?id=1080490 http://bugzilla.opensuse.org/show_bug.cgi?id=1080490#c1 --- Comment #1 from Achim Gratz <Stromeko@NexGo.DE> --- Come to think of it, the beginning of the day should probably be computed in UTC, as that is for instance what ntpd uses to roll-over its statistics on. A configurable offset to that would probably be nice, too. Using UTC has the additional advantage that the DST nonsense never enters the picture. -- You are receiving this mail because: You are on the CC list for the bug.
http://bugzilla.opensuse.org/show_bug.cgi?id=1080490 http://bugzilla.opensuse.org/show_bug.cgi?id=1080490#c2 --- Comment #2 from Achim Gratz <Stromeko@NexGo.DE> --- I went for this incantation in /usr/lib/cron/run-crons: # run as usual else TIME="-cmin +$((1 + ($($DATE +%s)-$($DATE -d today' '${CRON_DAILY_NOT_BEFORE:-04:00} +%s))/60))" fi ;; cron.weekly) TIME="-cmin +10080 -or -cmin 10080" ;; DATE is defined so that it can be switched to use UTC or the local timezone by a sysconfig variable and CRON_DAILY_NOT_BEFORE should also be a sysconfig variable. -- You are receiving this mail because: You are on the CC list for the bug.
http://bugzilla.opensuse.org/show_bug.cgi?id=1080490 http://bugzilla.opensuse.org/show_bug.cgi?id=1080490#c3 --- Comment #3 from Achim Gratz <Stromeko@NexGo.DE> --- One more comment on that script: Stuff like "-cmin +10080 -or -cmin 10080" is uselessly taking up space, mental capacity and runtime to figure out what it does, I'd just write "-cmin +10079" or "-cmin +$((10080-1))". -- You are receiving this mail because: You are on the CC list for the bug.
http://bugzilla.opensuse.org/show_bug.cgi?id=1080490 http://bugzilla.opensuse.org/show_bug.cgi?id=1080490#c5 --- Comment #5 from Achim Gratz <Stromeko@NexGo.DE> --- (In reply to Achim Gratz from comment #4)
Created attachment 792240 [details] proposed patch
So here's what I've been using for almost a year now in the hope that it'll get things finally moving towards fixing the problem.
Can this be fixed? I'm getting tired of having to re-patch the file each time an update changes it back to the buggy version. -- You are receiving this mail because: You are on the CC list for the bug.
http://bugzilla.opensuse.org/show_bug.cgi?id=1080490 http://bugzilla.opensuse.org/show_bug.cgi?id=1080490#c6 --- Comment #6 from Achim Gratz <Stromeko@NexGo.DE> --- (In reply to Achim Gratz from comment #5)
Can this be fixed? I'm getting tired of having to re-patch the file each time an update changes it back to the buggy version.
Ping? -- You are receiving this mail because: You are on the CC list for the bug.
participants (2)
-
bugzilla_noreply@novell.com
-
bugzilla_noreply@suse.com