diff options
author | 2015-07-22 07:12:16 +0000 | |
---|---|---|
committer | 2015-07-22 07:12:16 +0000 | |
commit | e7e3f3450a08144e3387fb3b065c13fd8327d6a6 (patch) | |
tree | 2ab58743cdbeb430f1e06fbf4520a2015d831ea7 /sys-process | |
parent | Mark arm64/m68k/s390/sh stable. (diff) | |
download | historical-e7e3f3450a08144e3387fb3b065c13fd8327d6a6.tar.gz historical-e7e3f3450a08144e3387fb3b065c13fd8327d6a6.tar.bz2 historical-e7e3f3450a08144e3387fb3b065c13fd8327d6a6.zip |
When any script fails, log the failure explicitly in case the job itself produced no output, and exit non-zero so higher levels can detect and take action #491520 by Thomas D..
Package-Manager: portage-2.2.20/cvs/Linux x86_64
Manifest-Sign-Key: 0xD2E96200
Diffstat (limited to 'sys-process')
-rw-r--r-- | sys-process/cronbase/ChangeLog | 10 | ||||
-rw-r--r-- | sys-process/cronbase/Manifest | 30 | ||||
-rw-r--r-- | sys-process/cronbase/cronbase-0.3.5.ebuild | 33 | ||||
-rwxr-xr-x | sys-process/cronbase/files/run-crons-0.3.5 | 127 |
4 files changed, 185 insertions, 15 deletions
diff --git a/sys-process/cronbase/ChangeLog b/sys-process/cronbase/ChangeLog index 629102a7e889..5de901462542 100644 --- a/sys-process/cronbase/ChangeLog +++ b/sys-process/cronbase/ChangeLog @@ -1,6 +1,14 @@ # ChangeLog for sys-process/cronbase # Copyright 1999-2015 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/sys-process/cronbase/ChangeLog,v 1.43 2015/07/22 01:22:28 vapier Exp $ +# $Header: /var/cvsroot/gentoo-x86/sys-process/cronbase/ChangeLog,v 1.44 2015/07/22 07:12:15 vapier Exp $ + +*cronbase-0.3.5 (22 Jul 2015) + + 22 Jul 2015; Mike Frysinger <vapier@gentoo.org> +cronbase-0.3.5.ebuild, + +files/run-crons-0.3.5: + When any script fails, log the failure explicitly in case the job itself + produced no output, and exit non-zero so higher levels can detect and take + action #491520 by Thomas D.. *cronbase-0.3.4 (22 Jul 2015) diff --git a/sys-process/cronbase/Manifest b/sys-process/cronbase/Manifest index 44157e025b0e..16ad4a9383f2 100644 --- a/sys-process/cronbase/Manifest +++ b/sys-process/cronbase/Manifest @@ -3,24 +3,26 @@ Hash: SHA256 AUX run-crons-0.3.3 3254 SHA256 77aa0820f5827b7fa2c35f877c2dc617c85c0ac80c35002624be091da520141a SHA512 b9f1dce57cb10ae17135bef3d197d411d802feee6645fbd753a08d154a2ab51b08f883995f041be73fd5e9e8c1a3fad487fbb02a141dd6644c339468bfe6c81d WHIRLPOOL 74e31eed4ba85548f89e5a0fa1a6bfb1a47f5b1dad9e2e75c33d796e39216ff6b88ed4e29bbb5ff59f81dfe3aa72268081eb33a4008c440a43303dde3ad2425e AUX run-crons-0.3.4 3350 SHA256 f9671f7f5d0b31f7936c25acdd4cf16ff9d48fc5c9ff87206da8e0ca98a4abba SHA512 79fdeaa3934f9d933d00904859e433d3030f85fecfd6c7d6c97ea6033b1f3a1904c015a41e1b735d28f0b6757cecb27fd34d233e1d159112872c3d6dddaa8654 WHIRLPOOL 00ccdb335ba822406a840f6b0aa9b9b12fafe05e3ea324b00f9605f1297df6b14cfd131962043ad3657bab2395da3864e7c773e2426e6cdd8e22d009330b14bd +AUX run-crons-0.3.5 3530 SHA256 6d2d323e365d358acc03e864c279415eac4cf0a9d64a14f46a5fe039659269b6 SHA512 918b5270bcdf8054eb38c2e72f2e1e834f612e067c19fb598f1e99b4e2b706fe64e5ca8cafdfd071d9afa00ec7d55c45015c93b8046ef6b88aaa309203b074dd WHIRLPOOL 2a06503e993d31fb6d11dbce0442b3d29c560433238ff2f25bf59ff2104866f37a75870716f913ea53263aa634495706ea06fdc0b58d2c917b2ad20744acaaa6 EBUILD cronbase-0.3.3.ebuild 1401 SHA256 a964082ffb1ec5b03fc534597dd916ed1e8259508a289010957adf1d8facf28a SHA512 c9d6fe9c66345625afef2fbac2d602fcaea7f54acef6e9c5713c43964e3c3f1af96d711e620cbc79b422b5d1157c1cf16e9faac8b43fea6e82ff376677d2c6a4 WHIRLPOOL d2f7abdfd53061e02bbaf6192088a4866d96fb931ba3335b8159974296a4f21ce910bb385818ec3d2d776d8e06b4874b022cd32ca9fae52b0e0dd446f5901339 EBUILD cronbase-0.3.4.ebuild 803 SHA256 85445fdb90299c616fb34534cdce726a0a8dc612367470541b0215ded016db8d SHA512 a976aa24a4091a7c70cce219723108d9f0379a384059875b32a1f03af17dc464ae97dae51d17da952befde3f3b30d38f0c3d481c1c5debb1da4a4357dc6a6ed1 WHIRLPOOL 4ca6cb7f49e577152c9254fbcc6019db0b39673fd35ab14223b9fa34ae1e1da631be7e353dd6c0b33c971badadaf88ea3f736ab96fcaef933d18b1f42b01aaea -MISC ChangeLog 9188 SHA256 fcb9c26d1480464a6d4b868260f472aa4578dc60e0bc995a66f44343dc809367 SHA512 a0837ebcdeba1b34925ce75f79ccc01a878e015bbe95a3a0d44b983e919f32129e302dddb2c9ae1bba3bf09f2b0cf5be19427c3b72782c9901db4f2958341945 WHIRLPOOL eab762be4b44ac179d09f139a7ad789f15658ad7a3ce23e6f87d27c8e9a177284b109369680500eccba786828dfc078fe73a4a54b9bf79171e4805bc64b00631 +EBUILD cronbase-0.3.5.ebuild 803 SHA256 16cc3a6b3d632fa2fcd0eff56b15428e429b7feab0c7250624e92347a4eb7b36 SHA512 fc7fe0f62c81e18b91fd9a9a9171c78d4ce4071bb70e98de510177be9e7d9e8599355527c36398e2ea4817f9ffe7eafbce9819d5a224a3a41f4541feeef065ea WHIRLPOOL 9951945c62162f653c49a10eb822b8f57aee5c8b4fb137dbcca4a4016533877e049a804aea648cd60cdc73fa41abc67be49ffa0d2861e108ac272b6de6ae595a +MISC ChangeLog 9503 SHA256 b15afeb280c99a1ebe5278c2bc681084d2de99ccbc72af704ee11262426b5b99 SHA512 f4f3e815ad5a7fd9c89bbeb87b514e9d642ad1ae147ce0484972a9cebbd581980bcf78008aae9851d236088f44a9a9e8fea1a4d3d32192e3c79aa128fbdef0c1 WHIRLPOOL 70cc04d1aaa420838ed7340d80603e0230078a8fa64755edcb9e47759afcf1a952ee0fc11077dcf5d676f3fd7be683e6519663397ab9fc29126b6971bab05011 MISC metadata.xml 158 SHA256 a262a73b2049a89ab6a4bdf51df27bea44c7f0aa0ee33176c59a9c63eb45e764 SHA512 0848ecc6b5e718ad001952843f69815fd8c3f50d126d3a2bbc48b86a9bfa21eab50fdb2eb11188362b8ead9db4cefb3719b53e0b76e4412a7a9a377a091e60bc WHIRLPOOL 3034b4ecfc87a8678ffab15dfc07af401c1b53660f7369b80a63b5c20300a3701068e87d7f6ff28ac1fd1c373051ce895e0316ecf7d9e91ad4eb627702b1ba02 -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 -iQIbBAEBCAAGBQJVrvBVAAoJEPGu1DbS6WIAJPQP92jRI4jPZxTdep4I6N/1jacF -VcKnn4rD/xcGtdx43u7pXnQrFRCNUOJFGS2zKiRYfahuP4YjlufmqCjYlwbGOWx5 -v73TYih4eSqd/VG8NWORYzrOlYlJtY1hMRBooJaTGPXEvEaQC668OVYi7B6FXGlE -vGemgfTW8PsCuuHyPZW/QfZNrFCWb/ryjGEpXM/H5SEWfbzCKm+8qL6Wog3q1i27 -JWkDKBY04eYFKrpeVLv/MlAXEGSUM5J/3OPBgAnOMmk3DmVGAbuGxbOlTCDGONX/ -DtnKRxe5WxJj+5kxeN309WDxDtGUST0Of/pryoQE5OiDHjvUmor61KuFsNzlX9Mq -u2QXWLG1otjv4K44r2jYXR0k2tMD47FZT9Skq3K6FqU0Gyj+AYu9jkFtOKbNxtsY -IBsYJ206+7qK1Fg81Iit1uNI8BH4en4pV4PxzenXVSa7PbDyOtS86dbVnXF3weox -MsaGZPmzvAko1D9EkLLOkAeHFQhUceve1Knmwq7c5+DiT7+zYP/s8iTlXjh2P5nA -qCP5KQXGzZtNq/fGKIYsvQJSsVKV7/2nxAdQdyVjpyhzh4L46bbk8G9lMJm9lvHc -XbL0XOy8u0Vn0hqVIx8nKlDuOIkCSKJmaCUgs3RGpZ9RWf7c2LAme96AlSfS+71T -llPTBl92kDzIK6LGb0Q= -=A3Mr +iQIcBAEBCAAGBQJVr0JPAAoJEPGu1DbS6WIAfWgP/0UQw5fNzY0SidXJ2aw7zKcG +tChKxhB+Kp+8EtciRtOlYLBdJ7BbgCmGPiZioolV2X7G5V14iaomAwU2bKmWCBj2 +CCx8G/51nPVZXy01Cxn+qLGRzj9hTucmyUnDxDbl5wd395inI3obwF2bQIy9mUxv +UJV+UcYahBewjwS+H9BcX/Pu2GYZwWoPLf6rQThy18ow+UhM1VvZXBr9Ofc/+gni +s84tAUUlDnSU8JDXZweDt1BOfP709aik3pVnnXxm2wi2TFEWr78bBpEN454qzGRL +b6B1GzaqucRdNStCuimCay6yTMkuxXgyOYS+8aPWABOKpIuhF7dwlvfyDH3iqmIE +7ZakRRbxpQIpgsxf6XQG7hCMAP7kgVW6CRYJH8OPklQ+aV8rSl92mkD3G1xOwaMS +e9KEutfBNbxbJVVbIPcXx5hdtWoJ25f2FNtcHcfe/Kv7JLaWpAvwVZHpQRPDV9iH +u2O7aur8KPgSVxO1nVzPVBjGv718I6Snj1PHja84Szl3FAS0cU0B4VUGEJxAByz/ +EgRuVUocJI/+7tcWd8NzkgTB+0Go/FsmIEv/vdfgBOqaZASMFoT6ER58vshDYPgt +K6nyu5xgW+fmMOoTQLL1nzYENImlpTqJ8TOfmkdmOudoTwUDq/7YHq+9QV7tY8u7 +Znvz4qSfQEVlmszs/ahy +=zSL/ -----END PGP SIGNATURE----- diff --git a/sys-process/cronbase/cronbase-0.3.5.ebuild b/sys-process/cronbase/cronbase-0.3.5.ebuild new file mode 100644 index 000000000000..5762bf66923b --- /dev/null +++ b/sys-process/cronbase/cronbase-0.3.5.ebuild @@ -0,0 +1,33 @@ +# Copyright 1999-2015 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/sys-process/cronbase/cronbase-0.3.5.ebuild,v 1.1 2015/07/22 07:12:15 vapier Exp $ + +EAPI="5" + +inherit user + +DESCRIPTION="base for all cron ebuilds" +HOMEPAGE="http://www.gentoo.org/" + +LICENSE="GPL-2" +SLOT="0" +KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~sparc-fbsd ~x86-fbsd" +IUSE="" + +S=${WORKDIR} + +pkg_setup() { + enewgroup cron 16 + enewuser cron 16 -1 /var/spool/cron cron +} + +src_install() { + newsbin "${FILESDIR}"/run-crons-${PV} run-crons + + diropts -m0750 + keepdir /etc/cron.{hourly,daily,weekly,monthly} + + keepdir /var/spool/cron/lastrun + diropts -m0750 -o root -g cron + keepdir /var/spool/cron +} diff --git a/sys-process/cronbase/files/run-crons-0.3.5 b/sys-process/cronbase/files/run-crons-0.3.5 new file mode 100755 index 000000000000..a8b6ad2c4c8c --- /dev/null +++ b/sys-process/cronbase/files/run-crons-0.3.5 @@ -0,0 +1,127 @@ +#!/bin/bash +# +# $Header: /var/cvsroot/gentoo-x86/sys-process/cronbase/files/run-crons-0.3.5,v 1.1 2015/07/22 07:12:15 vapier Exp $ +# +# 12 Oct 2008; Thilo Bangert <bangert@gentoo.org> run-crons: +# ignore emacs backup files (bug #237200) +# include logging patch (bug #140869) +# +# 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 + +# Usage: log <args to logger> +log() { + logger -i -p cron.info -t run-crons "$@" +} + +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 + + +EXIT_STATUS=0 +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 + # Filter out files people do not expect to be executed. + case ${SCRIPT} in + .*|*~) continue ;; + esac + + log "($(whoami)) CMD (${SCRIPT})" + $SCRIPT + ret=$? + if [ ${ret} -ne 0 ] ; then + log "CMD (${SCRIPT}) failed with exit status ${ret}" + EXIT_STATUS=1 + fi + 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 + +exit ${EXIT_STATUS} |