summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAaron Walker <ka0ttic@gentoo.org>2005-03-09 12:51:34 +0000
committerAaron Walker <ka0ttic@gentoo.org>2005-03-09 12:51:34 +0000
commit2bab16d2f53344f5fe4e259af105e722fd585912 (patch)
treef68c750a0534ef604d774bb6814e1aef8fd1e440 /sys-process/cronbase
parentStable on sparc (diff)
downloadgentoo-2-2bab16d2f53344f5fe4e259af105e722fd585912.tar.gz
gentoo-2-2bab16d2f53344f5fe4e259af105e722fd585912.tar.bz2
gentoo-2-2bab16d2f53344f5fe4e259af105e722fd585912.zip
Version bump; hopefully fixes bug 8506 (again).
(Portage version: 2.0.51.19)
Diffstat (limited to 'sys-process/cronbase')
-rw-r--r--sys-process/cronbase/ChangeLog8
-rw-r--r--sys-process/cronbase/Manifest23
-rw-r--r--sys-process/cronbase/cronbase-0.3.2.ebuild27
-rw-r--r--sys-process/cronbase/files/digest-cronbase-0.3.20
-rwxr-xr-xsys-process/cronbase/files/run-crons-0.3.2107
5 files changed, 149 insertions, 16 deletions
diff --git a/sys-process/cronbase/ChangeLog b/sys-process/cronbase/ChangeLog
index 348d97be0c60..f29e5edaf56c 100644
--- a/sys-process/cronbase/ChangeLog
+++ b/sys-process/cronbase/ChangeLog
@@ -1,6 +1,12 @@
# ChangeLog for sys-process/cronbase
# Copyright 2002-2005 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/sys-process/cronbase/ChangeLog,v 1.1 2005/03/04 23:24:54 ciaranm Exp $
+# $Header: /var/cvsroot/gentoo-x86/sys-process/cronbase/ChangeLog,v 1.2 2005/03/09 12:51:34 ka0ttic Exp $
+
+*cronbase-0.3.2 (09 Mar 2005)
+
+ 09 Mar 2005; Aaron Walker <ka0ttic@gentoo.org> +files/run-crons-0.3.2,
+ +cronbase-0.3.2.ebuild:
+ Version bump; hopefully fixes bug 8506 (again).
*cronbase-0.2.1-r3 (04 Mar 2005)
diff --git a/sys-process/cronbase/Manifest b/sys-process/cronbase/Manifest
index 10b8c39bfa0d..4a9e07c4ffa8 100644
--- a/sys-process/cronbase/Manifest
+++ b/sys-process/cronbase/Manifest
@@ -1,22 +1,15 @@
------BEGIN PGP SIGNED MESSAGE-----
-Hash: SHA1
-
-MD5 6eaaa244afa1aa0b96112382e643d6f6 cronbase-0.3.ebuild 795
-MD5 a8e24ef3f11a86a855b10ff1d0bb6f84 ChangeLog 3909
MD5 7fac489e4fdfb2d9c7628aac43b5a690 cronbase-0.3.1.ebuild 799
+MD5 6eaaa244afa1aa0b96112382e643d6f6 cronbase-0.3.ebuild 795
+MD5 0dabd159fe5e436a9fec97a5b5412f88 cronbase-0.3.2.ebuild 811
MD5 cb008353dea555fdac9dde6d43a47dbe cronbase-0.2.1-r3.ebuild 800
+MD5 b04281cb871f2b2ba27946a6d36a717b ChangeLog 4090
MD5 9c8fdf815ce980c230d763b496d4d088 metadata.xml 158
MD5 b24a8cee126be26a019b3e31b072f226 files/run-crons-0.3 2641
-MD5 d41d8cd98f00b204e9800998ecf8427e files/digest-cronbase-0.3.1 0
-MD5 d41d8cd98f00b204e9800998ecf8427e files/digest-cronbase-0.3 0
+MD5 8a5efc0f1ab99d6942692ea684cd72c5 files/run-crons-0.2.1 1962
MD5 e97f3765fe2a786526128816cd5d5d11 files/run-crons-0.3.1 2802
+MD5 02a6044a4fc2ebf48ecd5e8a1fabf46b files/run-crons-0.3.2 3076
MD5 790f5f4a29421ae2ca3bd4a6d150bb71 files/README 2861
+MD5 d41d8cd98f00b204e9800998ecf8427e files/digest-cronbase-0.3 0
MD5 d41d8cd98f00b204e9800998ecf8427e files/digest-cronbase-0.2.1-r3 0
-MD5 8a5efc0f1ab99d6942692ea684cd72c5 files/run-crons-0.2.1 1962
------BEGIN PGP SIGNATURE-----
-Version: GnuPG v1.2.6 (GNU/Linux)
-
-iD8DBQFCKO40LLFUmVNQ7rkRAnIuAKCMmdgGWVMARFJJbFiwqGPJ8y29+ACfQ9Ve
-GK6mYFohhblE59WTUQUgX88=
-=u0uI
------END PGP SIGNATURE-----
+MD5 d41d8cd98f00b204e9800998ecf8427e files/digest-cronbase-0.3.1 0
+MD5 d41d8cd98f00b204e9800998ecf8427e files/digest-cronbase-0.3.2 0
diff --git a/sys-process/cronbase/cronbase-0.3.2.ebuild b/sys-process/cronbase/cronbase-0.3.2.ebuild
new file mode 100644
index 000000000000..feb8845dc4aa
--- /dev/null
+++ b/sys-process/cronbase/cronbase-0.3.2.ebuild
@@ -0,0 +1,27 @@
+# Copyright 1999-2005 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/sys-process/cronbase/cronbase-0.3.2.ebuild,v 1.1 2005/03/09 12:51:34 ka0ttic Exp $
+
+DESCRIPTION="base for all cron ebuilds"
+HOMEPAGE="http://www.gentoo.org/"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86"
+IUSE=""
+
+src_install() {
+ exeinto /usr/sbin
+ newexe ${FILESDIR}/run-crons-${PV} run-crons || die
+
+ 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-process/cronbase/files/digest-cronbase-0.3.2 b/sys-process/cronbase/files/digest-cronbase-0.3.2
new file mode 100644
index 000000000000..e69de29bb2d1
--- /dev/null
+++ b/sys-process/cronbase/files/digest-cronbase-0.3.2
diff --git a/sys-process/cronbase/files/run-crons-0.3.2 b/sys-process/cronbase/files/run-crons-0.3.2
new file mode 100755
index 000000000000..d2b3631c7428
--- /dev/null
+++ b/sys-process/cronbase/files/run-crons-0.3.2
@@ -0,0 +1,107 @@
+#!/bin/bash
+#
+# $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 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.
+# See bug 8506.
+#
+# 06 May 2004; Aron Griffis <agriffis@gentoo.org> run-crons:
+# Make the locking actually work. The old code was racy.
+# Thanks to Mathias Gumz in bug 45155 for some cleanups.
+#
+# 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
+#
+# this script looks into /etc/cron.[hourly|daily|weekly|monthly]
+# for scripts to be executed. The info about last run is stored in
+# /var/spool/cron/lastrun
+
+LOCKDIR=/var/spool/cron/lastrun
+LOCKFILE=${LOCKDIR}/lock
+
+mkdir -p ${LOCKDIR}
+
+# Make sure we're not running multiple instances at once.
+# Try twice to lock, otherwise give up.
+for ((i = 0; i < 2; i = i + 1)); do
+ ln -sn $$ ${LOCKFILE} 2>/dev/null && break
+
+ # lock failed, check for a running process.
+ # handle both old- and new-style locking.
+ cronpid=$(readlink ${LOCKFILE} 2>/dev/null) ||
+ cronpid=$(cat ${LOCKFILE} 2>/dev/null) ||
+ continue # lockfile disappeared? try again
+
+ # better than kill -0 because we can verify that it's really
+ # another run-crons process
+ if [[ $(</proc/${cronpid}/cmdline) == $(</proc/$$/cmdline) ]] 2>/dev/null; then
+ # whoa, another process is really running
+ exit 0
+ else
+ rm -f ${LOCKFILE}
+ fi
+done
+
+# Check to make sure locking was successful
+if [[ ! -L ${LOCKFILE} ]]; then
+ echo "Can't create or read existing ${LOCKFILE}, giving up"
+ exit 1
+fi
+
+# Set a trap to remove the lockfile when we're finished
+trap "rm -f ${LOCKFILE}" 0 1 2 3 15
+
+
+for BASE in hourly daily weekly monthly
+do
+ CRONDIR=/etc/cron.${BASE}
+
+ test -d $CRONDIR || continue
+
+ if [ -e ${LOCKDIR}/cron.$BASE ]
+ then
+ case $BASE in
+ hourly)
+ #>= 1 hour, 5 min -=> +65 min
+ TIME="-cmin +65" ;;
+ daily)
+ #>= 1 day, 5 min -=> +1445 min
+ TIME="-cmin +1445" ;;
+ weekly)
+ #>= 1 week, 5 min -=> +10085 min
+ TIME="-cmin +10085" ;;
+ monthly)
+ #>= 31 days, 5 min -=> +44645 min
+ TIME="-cmin +44645" ;;
+ esac
+ find ${LOCKDIR} -name cron.$BASE $TIME -exec rm {} \; &>/dev/null || true
+ fi
+
+ # if there is no touch file, make one then run the scripts
+ if [ ! -e ${LOCKDIR}/cron.$BASE ]
+ then
+ touch ${LOCKDIR}/cron.$BASE
+
+ set +e
+ for SCRIPT in $CRONDIR/*
+ do
+ if [[ -x $SCRIPT && ! -d $SCRIPT ]]; then
+ $SCRIPT
+ fi
+ done
+ fi
+done
+
+# Clean out bogus cron.$BASE files with future times
+touch ${LOCKDIR}
+find ${LOCKDIR} -newer ${LOCKDIR} -exec /bin/rm -f {} \; &>/dev/null || true