--- gentoo-x86/sys-apps/cronbase/files/run-crons Mon May 13 21:27:02 2002 +++ /usr/sbin/run-crons Fri Jun 21 11:46:55 2002 @@ -19,23 +19,30 @@ # -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 && { + # if the touch file is older than {hourly,daily,...} remove it + # Why is this in here at all? Don't the cron jobs from /etc/crontab + # take care of this for us? + if test -f /var/spool/cron/lastrun/$BASE + then case $BASE in - cron.hourly) TIME="-cmin +60 -or -cmin 60" ;; - cron.daily) TIME="-ctime +1 -or -ctime 1" ;; - cron.weekly) TIME="-ctime +7 -or -ctime 7" ;; - cron.monthly) TIME="-ctime +30 -or -ctime 30" ;; + cron.hourly) TIME="-cmin +59" ;; + cron.daily) TIME="-ctime +0" ;; + cron.weekly) TIME="-ctime +6" ;; + cron.monthly) TIME="-ctime +29" ;; esac - eval find /var/spool/cron/lastrun/$BASE $TIME | \ - xargs --no-run-if-empty rm - } - if test ! -e /var/spool/cron/lastrun/$BASE ; then + find /var/spool/cron/lastrun/$BASE $TIME -exec /bin/rm -f {} \; + fi + + # if there is no touch file, make one then run the scripts + if test ! -f /var/spool/cron/lastrun/$BASE + then + touch /var/spool/cron/lastrun/$BASE set +e @@ -52,6 +59,5 @@ # touch /var/spool/cron/lastrun -find /var/spool/cron/lastrun -newer /var/spool/cron/lastrun | \ - xargs --no-run-if-empty rm +find /var/spool/cron/lastrun -newer /var/spool/cron/lastrun -exec /bin/rm -f {} \;