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.