diff options
author | 2002-06-23 17:37:19 +0000 | |
---|---|---|
committer | 2002-06-23 17:37:19 +0000 | |
commit | 8e28e1984ed14f5d49d63e8378742a7da1dd87ac (patch) | |
tree | 19109c7db7a1e85d51d893d115de74c8735b6eac /sys-apps/cronbase | |
parent | See the ChangeLog entry for details (diff) | |
download | historical-8e28e1984ed14f5d49d63e8378742a7da1dd87ac.tar.gz historical-8e28e1984ed14f5d49d63e8378742a7da1dd87ac.tar.bz2 historical-8e28e1984ed14f5d49d63e8378742a7da1dd87ac.zip |
new release - due to a race condition in the previous run-crons - thanks jnelson and george for the QA
Diffstat (limited to 'sys-apps/cronbase')
-rw-r--r-- | sys-apps/cronbase/ChangeLog | 4 | ||||
-rw-r--r-- | sys-apps/cronbase/cronbase-0.2.ebuild | 36 | ||||
-rw-r--r-- | sys-apps/cronbase/files/digest-cronbase-0.2 | 0 | ||||
-rw-r--r-- | sys-apps/cronbase/files/run-crons | 42 |
4 files changed, 54 insertions, 28 deletions
diff --git a/sys-apps/cronbase/ChangeLog b/sys-apps/cronbase/ChangeLog index d4a250909685..a898f5da1cea 100644 --- a/sys-apps/cronbase/ChangeLog +++ b/sys-apps/cronbase/ChangeLog @@ -1,8 +1,8 @@ # ChangeLog for sys-apps/cronbase # Copyright 2002 Gentoo Technologies, Inc.; Distributed under the GPL -# $Header: /var/cvsroot/gentoo-x86/sys-apps/cronbase/ChangeLog,v 1.3 2002/06/21 09:25:48 bangert Exp $ +# $Header: /var/cvsroot/gentoo-x86/sys-apps/cronbase/ChangeLog,v 1.4 2002/06/23 17:37:19 bangert Exp $ - 21 Jun 2002; Thilo Bangert <bangert@gentoo.org> files/run-crons : + 23 Jun 2002; Thilo Bangert <bangert@gentoo.org> files/run-crons : minor fixors/cleanups - suggested by jon nelson diff --git a/sys-apps/cronbase/cronbase-0.2.ebuild b/sys-apps/cronbase/cronbase-0.2.ebuild new file mode 100644 index 000000000000..83f22a29b069 --- /dev/null +++ b/sys-apps/cronbase/cronbase-0.2.ebuild @@ -0,0 +1,36 @@ +# Copyright 1999-2002 Gentoo Technologies, Inc. +# Distributed under the terms of the GNU General Public License, v2 +# Author: Thilo Bangert <bangert@gentoo.org> +# $Header: /var/cvsroot/gentoo-x86/sys-apps/cronbase/cronbase-0.2.ebuild,v 1.1 2002/06/23 17:37:19 bangert Exp $ + +DESCRIPTION="The is the base for all cron ebuilds." +HOMEPAGE="http://www.gentoo.org/" +LICENSE="GPL-2" + +#adds ".keep" files so that dirs aren't auto-cleaned +keepdir() { + dodir $* + local x + for x in $* + do + touch ${D}/${x}/.keep + done +} + +src_install () { + + exeinto /usr/sbin + doexe ${FILESDIR}/run-crons + + diropts -m0750; keepdir /etc/cron.hourly + diropts -m0750; keepdir /etc/cron.daily + diropts -m0750; keepdir /etc/cron.weekly + diropts -m0750; keepdir /etc/cron.monthly + + diropts -m0750 -o root -g cron; keepdir /var/spool/cron + + diropts -m0750; keepdir /var/spool/cron/lastrun + + dodoc ${FILESDIR}/README + +} diff --git a/sys-apps/cronbase/files/digest-cronbase-0.2 b/sys-apps/cronbase/files/digest-cronbase-0.2 new file mode 100644 index 000000000000..e69de29bb2d1 --- /dev/null +++ b/sys-apps/cronbase/files/digest-cronbase-0.2 diff --git a/sys-apps/cronbase/files/run-crons b/sys-apps/cronbase/files/run-crons index db777be9aa4c..7c4351ec56fe 100644 --- a/sys-apps/cronbase/files/run-crons +++ b/sys-apps/cronbase/files/run-crons @@ -1,12 +1,16 @@ #!/bin/sh # -# $Header: /var/cvsroot/gentoo-x86/sys-apps/cronbase/files/run-crons,v 1.4 2002/06/21 09:25:48 bangert Exp $ +# $Header: /var/cvsroot/gentoo-x86/sys-apps/cronbase/files/run-crons,v 1.5 2002/06/23 17:37:19 bangert Exp $ +# +# 23 Jun 2002; Jon Nelson <jnelson@gentoo.org> run-crons: +# +# fixed a race condition, where cron jobs and run-crons wanted to delete +# touch files # # 20 Apr 2002; Thilo Bangert <bangert@gentoo.org> run-crons: # # moved lastrun directory to /var/spool/cron/lastrun # -# # Author: Achim Gottinger <achim@gentoo.org> # # Mostly copied from SuSE @@ -19,31 +23,17 @@ mkdir -p /var/spool/cron/lastrun # -for CRONDIR in /etc/cron.{hourly,daily,weekly,monthly} +for BASE in hourly daily weekly monthly do - + CRONDIR=/etc/cron.${BASE} + test -d $CRONDIR || continue - BASE=${CRONDIR##*/} - test -e /var/spool/cron/lastrun/$BASE && { - - case $BASE in - cron.hourly) - #> 59 min =~ >= 60 min - TIME="-cmin +59 " ;; - cron.daily) - #>= 1 day - TIME="-ctime +1 -or -ctime 1" ;; - cron.weekly) - #>= 7 days - TIME="-ctime +7 -or -ctime 7" ;; - cron.monthly) - #>= 30 days - TIME="-ctime +30 -or -ctime 30" ;; - esac - find /var/spool/cron/lastrun/$BASE $TIME -exec rm {} \; - } - if test ! -e /var/spool/cron/lastrun/$BASE ; then - touch /var/spool/cron/lastrun/$BASE + + # if there is no touch file, make one then run the scripts + if test ! -f /var/spool/cron/lastrun/cron.$BASE + then + + touch /var/spool/cron/lastrun/cron.$BASE set +e for SCRIPT in $CRONDIR/* @@ -59,5 +49,5 @@ done # touch /var/spool/cron/lastrun -find /var/spool/cron/lastrun -newer /var/spool/cron/lastrun -exec rm {} \; +find /var/spool/cron/lastrun -newer /var/spool/cron/lastrun -exec /bin/rm -f {} \; |