diff options
author | Preston A. Elder <prez@gentoo.org> | 2003-11-19 06:31:23 +0000 |
---|---|---|
committer | Preston A. Elder <prez@gentoo.org> | 2003-11-19 06:31:23 +0000 |
commit | d88361d655e81cc2be126d99c5c7c5cf646cf17a (patch) | |
tree | d3a6a3f33efdfed82294d6e1d505ac8f7014a949 /sys-apps/cronbase | |
parent | First import (diff) | |
download | historical-d88361d655e81cc2be126d99c5c7c5cf646cf17a.tar.gz historical-d88361d655e81cc2be126d99c5c7c5cf646cf17a.tar.bz2 historical-d88361d655e81cc2be126d99c5c7c5cf646cf17a.zip |
Updated run-crons to stop multiple instances executing at once.
Diffstat (limited to 'sys-apps/cronbase')
-rw-r--r-- | sys-apps/cronbase/ChangeLog | 11 | ||||
-rw-r--r-- | sys-apps/cronbase/cronbase-0.2.1-r3.ebuild | 26 | ||||
-rw-r--r-- | sys-apps/cronbase/files/digest-cronbase-0.2.1-r3 | 0 | ||||
-rw-r--r-- | sys-apps/cronbase/files/run-crons | 17 |
4 files changed, 48 insertions, 6 deletions
diff --git a/sys-apps/cronbase/ChangeLog b/sys-apps/cronbase/ChangeLog index b9b29a9253ce..5073ef7cb25a 100644 --- a/sys-apps/cronbase/ChangeLog +++ b/sys-apps/cronbase/ChangeLog @@ -1,6 +1,13 @@ # ChangeLog for sys-apps/cronbase # Copyright 2002-2003 Gentoo Technologies, Inc.; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/sys-apps/cronbase/ChangeLog,v 1.17 2003/09/17 21:15:27 avenj Exp $ +# $Header: /var/cvsroot/gentoo-x86/sys-apps/cronbase/ChangeLog,v 1.18 2003/11/19 06:31:23 prez Exp $ + +*cronbase-0.2.1-r3 (19 Nov 2003) + + 19 Nov 2003; Preston A. Elder <prez@gentoo.org> run-crons : + Added code to ensure only one run-crons instance runs at once. + +*cronbase-0.2.1-r2 (31 Jan 2003) 17 Sep 2003; Jon Portnoy <avenj@gentoo.org> cronbase-0.2.1-r2.ebuild : ia64 keywords. @@ -11,8 +18,6 @@ 07 Feb 2003; Guy Martin <gmsoft@gentoo.org> cronbase-0.2.1-r2.ebuild : Added hppa to keywords. -*cronbase-0.2.1-r2 (31 Jan 2003) - 31 Jan 2003; Preston A. Elder <prez@gentoo.org> run-crons : Chaged month delay from 30 to 31 days, as per Bug #14862 diff --git a/sys-apps/cronbase/cronbase-0.2.1-r3.ebuild b/sys-apps/cronbase/cronbase-0.2.1-r3.ebuild new file mode 100644 index 000000000000..dae9b472825d --- /dev/null +++ b/sys-apps/cronbase/cronbase-0.2.1-r3.ebuild @@ -0,0 +1,26 @@ +# Copyright 1999-2003 Gentoo Technologies, Inc. +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/sys-apps/cronbase/cronbase-0.2.1-r3.ebuild,v 1.1 2003/11/19 06:31:23 prez Exp $ + +DESCRIPTION="The is the base for all cron ebuilds." +HOMEPAGE="http://www.gentoo.org/" + +KEYWORDS="~x86 ~amd64 ~ppc ~sparc ~alpha ~mips ~hppa ~arm ~ia64" +SLOT="0" +LICENSE="GPL-2" + +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.1-r3 b/sys-apps/cronbase/files/digest-cronbase-0.2.1-r3 new file mode 100644 index 000000000000..e69de29bb2d1 --- /dev/null +++ b/sys-apps/cronbase/files/digest-cronbase-0.2.1-r3 diff --git a/sys-apps/cronbase/files/run-crons b/sys-apps/cronbase/files/run-crons index 647c18fa0999..84b1410436bb 100644 --- a/sys-apps/cronbase/files/run-crons +++ b/sys-apps/cronbase/files/run-crons @@ -1,6 +1,6 @@ #!/bin/sh # -# $Header: /var/cvsroot/gentoo-x86/sys-apps/cronbase/files/run-crons,v 1.8 2003/01/31 17:17:13 prez Exp $ +# $Header: /var/cvsroot/gentoo-x86/sys-apps/cronbase/files/run-crons,v 1.9 2003/11/19 06:31:23 prez Exp $ # # 23 Jun 2002; Jon Nelson <jnelson@gentoo.org> run-crons: # @@ -21,7 +21,17 @@ mkdir -p /var/spool/cron/lastrun -# +# Make sure its not running multiple instances at once. +if test -f /var/spool/cron/lastrun/lock +then + cronpid=`cat /var/spool/cron/lastrun/lock` + if `kill -0 $cronpid >/dev/null 2>&1` + then + exit 0 + fi +fi + +echo "$$" >/var/spool/cron/lastrun/lock for BASE in hourly daily weekly monthly do @@ -65,7 +75,8 @@ do fi done -# +# Remove lock, we're done. +rm -f /var/spool/cron/lastrun/lock touch /var/spool/cron/lastrun find /var/spool/cron/lastrun -newer /var/spool/cron/lastrun -exec /bin/rm -f {} \; |