[Bug 283218] New: cron.daily scripts get executed twice when setting DAILY_TIME in /etc/sysconfig/cron
https://bugzilla.novell.com/show_bug.cgi?id=283218 Summary: cron.daily scripts get executed twice when setting DAILY_TIME in /etc/sysconfig/cron Product: openSUSE 10.2 Version: Final Platform: i386 OS/Version: openSUSE 10.2 Status: NEW Severity: Normal Priority: P5 - None Component: Basesystem AssignedTo: bnc-team-screening@forge.provo.novell.com ReportedBy: ml-itshh@gft.com QAContact: qa@suse.de If DAILY_TIME is set to a specific time in /etc/sysconfig/cron scripts under /etc/cron.daily are getting executed twice a day. Problem: --------- In /usr/lib/cron/run-crons the range for running cron.daily scripts is to big: Line 97: if [ $(($DAILY_TIME_NEW - 15)) -lt "$NOW_H" ] && [ $(($DAILY_TIME_NEW + 15)) -gt "$NOW_H" ]; Example: -------- /usr/lib/cron/run-crons runs every 15 minutes on a default installation. Let's say we have set DAILY_TIME="00:25" in /etc/sysconfig/cron. Then the daily scripts get executed twice. * run-crons runs at 00:15 (NOW_H=0015 and DAILY_TIME_NEW=025): The shown if-statement will result to "if [ (010 < 0015) && (040 > 0015) ] then" and that is TRUE * run-crons runs at 00:30 (NOW_H=0030 and DAILY_TIME_NEW=025): The shown if-statement will result to "if [ (010 < 0030) && (040 > 0030) ] then" and that is TRUE again. Solution: --------- $ diff -b /usr/lib/cron/run-crons /usr/lib/cron/run-crons.new 92c92 < DAILY_TIME_NEW="`echo $DAILY_TIME | sed s,:,, | sed s,^0,, `" ---
DAILY_TIME_NEW="`echo $DAILY_TIME | sed s,:,, | sed s,^0\*,, `"
96,97c96,102 < NOW_H=`date +%H%M` < if [ $(($DAILY_TIME_NEW - 15)) -lt "$NOW_H" ] && [ $(($DAILY_TIME_NEW + 15)) -gt "$NOW_H" ]; then ---
NOW_H=`date +%H%M| sed s,^0\*,,` if [ $DAILY_TIME_NEW -gt $(($NOW_H-15)) ] && [ $DAILY_TIME_NEW -le $NOW_H ]; then
SIDENOTE: My patch removes all leading zeros in $DAILY_TIME_NEW and $NOW_H -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug, or are watching someone who is.
https://bugzilla.novell.com/show_bug.cgi?id=283218 chrubis@novell.com changed: What |Removed |Added ---------------------------------------------------------------------------- AssignedTo|bnc-team- |mkoenig@novell.com |screening@forge.provo.novell| |.com | -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug, or are watching someone who is.
https://bugzilla.novell.com/show_bug.cgi?id=283218 mkoenig@novell.com changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |DUPLICATE ------- Comment #1 from mkoenig@novell.com 2007-06-12 07:36 MST ------- Thanks, this is already fixed in stable. *** This bug has been marked as a duplicate of bug 244977 *** -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug, or are watching someone who is.
https://bugzilla.novell.com/show_bug.cgi?id=283218 ml-itshh@gft.com changed: What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |REOPENED Resolution|DUPLICATE | ------- Comment #2 from ml-itshh@gft.com 2007-06-13 01:32 MST ------- Hello again, I reopened this bug, because my bugreport was not about the 0s in the sed statement. The range of the shown if-statement is too big. Even with all leading 0s got stripped, cron.daily will be executed twice a day. See the example and remove all leading 0s and still it will trigger the if-statement two times. In my patch there is an corrected if-statement. Regards Willem Froehling -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug, or are watching someone who is.
https://bugzilla.novell.com/show_bug.cgi?id=283218 mkoenig@novell.com changed: What |Removed |Added ---------------------------------------------------------------------------- Status|REOPENED |RESOLVED Resolution| |FIXED ------- Comment #3 from mkoenig@novell.com 2007-06-13 10:10 MST ------- Ah, now I see. Sorry, read to fast. Now fixed in stable. -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug, or are watching someone who is.
participants (1)
-
bugzilla_noreply@novell.com