Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 106173 Details for
Bug 69777
sys-process/cronbase: /etc/crontab deletion of lastrun files causes run-crons to execute more often than it should
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
propsed fix for run-crons.
run-crons.diff (text/plain), 2.30 KB, created by
Peter Volkov (RETIRED)
on 2007-01-09 09:55:17 UTC
(
hide
)
Description:
propsed fix for run-crons.
Filename:
MIME Type:
Creator:
Peter Volkov (RETIRED)
Created:
2007-01-09 09:55:17 UTC
Size:
2.30 KB
patch
obsolete
>--- /usr/sbin/run-crons 2007-01-09 11:59:17.000000000 +0300 >+++ run-crons 2007-01-09 12:37:52.000000000 +0300 >@@ -2,6 +2,10 @@ > # > # $Header: /var/cvsroot/gentoo-x86/sys-process/cronbase/files/run-crons-0.3.2,v 1.1 2005/03/09 12:51:34 ka0ttic Exp $ > # >+# 08 Jan 2007; Volkov Peter <pva@gentoo.org> run-crons: >+# Use seconds since the epoch (date +%s) instead of time stamps to avoid >+# running crons twice caused by daylight saving time change. >+# > # 08 Mar 2005; Aaron Walker <ka0ttic@gentoo.org> run-crons: > # Ignore the error messages from find caused by race conditions, since > # we could care less about the error as long as the file has been removed. >@@ -61,6 +65,7 @@ > # Set a trap to remove the lockfile when we're finished > trap "rm -f ${LOCKFILE}" 0 1 2 3 15 > >+CUR_TIME=`date +%s` > > for BASE in hourly daily weekly monthly > do >@@ -71,26 +76,27 @@ > if [ -e ${LOCKDIR}/cron.$BASE ] > then > case $BASE in >+ # USE $BASE - 15 seconds to avoid shift on run-crons execution period. > hourly) >- #>= 1 hour, 5 min -=> +65 min >- TIME="-cmin +65" ;; >+ # 1 hour -=> 60 min = 3600 sec >+ TIME=$(( ${CUR_TIME} - 3585 )) ;; > daily) >- #>= 1 day, 5 min -=> +1445 min >- TIME="-cmin +1445" ;; >+ # 1 day -=> +1440 min = 86400 sec >+ TIME=$(( ${CUR_TIME} - 86385 )) ;; > weekly) >- #>= 1 week, 5 min -=> +10085 min >- TIME="-cmin +10085" ;; >+ # 1 week -=> +10080 min = 604800 sec >+ TIME=$(( ${CUR_TIME} - 604785 )) ;; > monthly) >- #>= 31 days, 5 min -=> +44645 min >- TIME="-cmin +44645" ;; >+ # 31 days -=> +44640 min = 2678400 sec >+ TIME=$(( ${CUR_TIME} - 2678385 )) ;; > esac >- find ${LOCKDIR} -name cron.$BASE $TIME -exec rm {} \; &>/dev/null || true >+ [ $(<${LOCKDIR}/cron.${BASE}) -lt ${TIME} ] && rm ${LOCKDIR}/cron.${BASE} > fi > > # if there is no touch file, make one then run the scripts > if [ ! -e ${LOCKDIR}/cron.$BASE ] > then >- touch ${LOCKDIR}/cron.$BASE >+ echo ${CUR_TIME} > ${LOCKDIR}/cron.$BASE > > set +e > for SCRIPT in $CRONDIR/* >@@ -103,5 +109,8 @@ > done > > # Clean out bogus cron.$BASE files with future times >-touch ${LOCKDIR} >-find ${LOCKDIR} -newer ${LOCKDIR} -exec /bin/rm -f {} \; &>/dev/null || true >+CUR_TIME=`date +%s` >+for cronfile in ${LOCKDIR}/cron.* >+do >+ [ $(<${cronfile}) -gt ${CUR_TIME} ] && rm ${cronfile} >+done
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 69777
:
106105
| 106173 |
500786