diff options
author | Ciaran McCreesh <ciaranm@gentoo.org> | 2005-03-04 23:24:54 +0000 |
---|---|---|
committer | Ciaran McCreesh <ciaranm@gentoo.org> | 2005-03-04 23:24:54 +0000 |
commit | 94ce95e761a09229b641094b22a5ee51b44cec21 (patch) | |
tree | e69d2e08322c01a6c5ddfcf48f7382159c3532b0 /sys-process/cronbase/files | |
parent | Adding keyword ~alpha for testing. (diff) | |
download | historical-94ce95e761a09229b641094b22a5ee51b44cec21.tar.gz historical-94ce95e761a09229b641094b22a5ee51b44cec21.tar.bz2 historical-94ce95e761a09229b641094b22a5ee51b44cec21.zip |
Move sys-apps/cronbase -> sys-process/cronbase
Package-Manager: portage-2.0.51.19
Diffstat (limited to 'sys-process/cronbase/files')
-rw-r--r-- | sys-process/cronbase/files/README | 119 | ||||
-rw-r--r-- | sys-process/cronbase/files/digest-cronbase-0.2.1-r3 | 0 | ||||
-rw-r--r-- | sys-process/cronbase/files/digest-cronbase-0.3 | 0 | ||||
-rw-r--r-- | sys-process/cronbase/files/digest-cronbase-0.3.1 | 0 | ||||
-rwxr-xr-x | sys-process/cronbase/files/run-crons-0.2.1 | 83 | ||||
-rwxr-xr-x | sys-process/cronbase/files/run-crons-0.3 | 96 | ||||
-rwxr-xr-x | sys-process/cronbase/files/run-crons-0.3.1 | 103 |
7 files changed, 401 insertions, 0 deletions
diff --git a/sys-process/cronbase/files/README b/sys-process/cronbase/files/README new file mode 100644 index 000000000000..42baf7d8ab2f --- /dev/null +++ b/sys-process/cronbase/files/README @@ -0,0 +1,119 @@ + +$Header: /var/cvsroot/gentoo-x86/sys-process/cronbase/files/README,v 1.1 2005/03/04 23:24:54 ciaranm Exp $ + +22 Apr 2oo2; Thilo Bangert <bangert@gentoo.org> + +initial release + + + +The Gentoo Linux Cron README +============================ + +Subject: New Cron Layout +Date: Mon, 22 Apr 2002 21:35:26 +0200 +From: Thilo Bangert <bangert@gentoo.org> +To: gentoo-dev@gentoo.org, gentoo-announce@gentoo.org, +gentoo-user@gentoo.org, gentoo-newbies@gentoo.org + + Hi, + +I have just unmasked + + sys-apps/cronbase-0.01 + sys-apps/dcron-2.7-r9 + sys-apps/fcron-2.0.0-r1 + sys-apps/vcron-3.0.1-r1 + +Users of + + sys-apps/dcron + sys-apps/fcron (or app-admin/fcron ) + sys-apps/vcron + +should read the following before updating to the new cron layout. + + +Features +-------- + +The new cron layout incorporates the following features: + + - to be able to use cron, a user must be part of the "cron" group. + + - cron spool files are located at /var/spool/cron/ for all cron's + + - all crons run /etc/cron.{hourly|daily|weekly|monthly} (fcron and + dcron users see notice below). + + - all crons PROVIDE=virtual/cron and future ebuilds will make use of + this. Ebuild developers are encourged to use it where applicable. + + - max one cron per system. + + - dcron is the Gentoo Linux "default" (ie. dcron gets installed if + something depends on virtual/cron and no cron has been installed + yet). + + +Upgrade instructions +-------------------- + +sys-apps/dcron: + + NOTE: fcron has been moved from the app-admin category to the + sys-apps category. + + to install the new dcron, do + # emerge --pretend sys-apps/dcron + # emerge sys-apps/dcron + + NOTE: to make use of /etc/cron.{hourly|daily|weekly|monthly} the root + crontab must include the contents of /etc/crontab. + + # crontab /etc/crontab + + !! This will REPLACE root's current crontab !! + + +sys-apps/fcron: + + to install the new fcron, do + # emerge --pretend sys-apps/fcron + # emerge sys-apps/fcron + + The default location for crontabs for fcron has been changed to + /var/spool/cron/fcrontabs. To make use of previous crontabs, copy + them to the new location. Make sure your new /etc/fcron/fcron.conf + reflects this. + + NOTE: to make use of /etc/cron.{hourly|daily|weekly|monthly} the root + crontab must include the contents of /etc/crontab. + + # crontab /etc/crontab + + !! This will REPLACE root's current crontab !! + + NEW: To be able to use cron as a user, the user must be part of the + "cron" group. + + +sys-apps/vcron: + + to install the new vcron, do + # emerge --pretend sys-apps/vcron + # emerge sys-apps/vcron + + NEW: To be able to use cron as a user, the user must be part of the + "cron" group. + + +Although the new layout has been tested, bugs may be present. +Please report them on http://bugs.gentoo.org and assign them +to bangert@gentoo.org. + +Thank you. + +regards +Thilo Bangert <bangert@gentoo.org> + diff --git a/sys-process/cronbase/files/digest-cronbase-0.2.1-r3 b/sys-process/cronbase/files/digest-cronbase-0.2.1-r3 new file mode 100644 index 000000000000..e69de29bb2d1 --- /dev/null +++ b/sys-process/cronbase/files/digest-cronbase-0.2.1-r3 diff --git a/sys-process/cronbase/files/digest-cronbase-0.3 b/sys-process/cronbase/files/digest-cronbase-0.3 new file mode 100644 index 000000000000..e69de29bb2d1 --- /dev/null +++ b/sys-process/cronbase/files/digest-cronbase-0.3 diff --git a/sys-process/cronbase/files/digest-cronbase-0.3.1 b/sys-process/cronbase/files/digest-cronbase-0.3.1 new file mode 100644 index 000000000000..e69de29bb2d1 --- /dev/null +++ b/sys-process/cronbase/files/digest-cronbase-0.3.1 diff --git a/sys-process/cronbase/files/run-crons-0.2.1 b/sys-process/cronbase/files/run-crons-0.2.1 new file mode 100755 index 000000000000..7f0ad86c7fc6 --- /dev/null +++ b/sys-process/cronbase/files/run-crons-0.2.1 @@ -0,0 +1,83 @@ +#!/bin/sh +# +# $Header: /var/cvsroot/gentoo-x86/sys-process/cronbase/files/run-crons-0.2.1,v 1.1 2005/03/04 23:24:54 ciaranm 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 +# +# 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 + +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 + CRONDIR=/etc/cron.${BASE} + + test -d $CRONDIR || continue + + if test -e /var/spool/cron/lastrun/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 /var/spool/cron/lastrun -name cron.$BASE $TIME -exec rm {} \; + fi + + # 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/* + do + test -d $SCRIPT && continue + if test -x $SCRIPT ; then + $SCRIPT + fi + done + 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 {} \; + diff --git a/sys-process/cronbase/files/run-crons-0.3 b/sys-process/cronbase/files/run-crons-0.3 new file mode 100755 index 000000000000..3d1c46298b7a --- /dev/null +++ b/sys-process/cronbase/files/run-crons-0.3 @@ -0,0 +1,96 @@ +#!/bin/bash +# +# $Header: /var/cvsroot/gentoo-x86/sys-process/cronbase/files/run-crons-0.3,v 1.1 2005/03/04 23:24:54 ciaranm Exp $ +# +# +# 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 + if [[ $? != 0 ]]; then + # lock failed, check for a running process. + # handle both old- and new-style locking. + cronpid=$(readlink ${LOCKFILE} 2>/dev/null || + cat ${LOCKFILE} 2>/dev/null) + if [[ $? == 0 ]]; then + if kill -0 ${cronpid} 2>/dev/null; then + # whoa, another process is really running + exit 0 + else + rm -f ${LOCKFILE} + fi + fi + fi +done + +# 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 {} \; + 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 {} \; diff --git a/sys-process/cronbase/files/run-crons-0.3.1 b/sys-process/cronbase/files/run-crons-0.3.1 new file mode 100755 index 000000000000..836e074900a3 --- /dev/null +++ b/sys-process/cronbase/files/run-crons-0.3.1 @@ -0,0 +1,103 @@ +#!/bin/bash +# +# $Header: /var/cvsroot/gentoo-x86/sys-process/cronbase/files/run-crons-0.3.1,v 1.1 2005/03/04 23:24:54 ciaranm Exp $ +# +# +# 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 {} \; + 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 {} \; |