System-Cronjobs werden nicht ausgeführt(Intern)


o TeX o Ascii

Supportdatenbank (wey_cron)
Bezieht sich auf

SuSE Linux: Version 6.0
Dieser Artikel bezieht sich auf eine ältere SuSE Linux Version. Daher ist es möglich, dass die Informationen in diesem Artikel nicht mehr auf dem neuesten Stand sind bzw. der Artikel nicht mehr funktionierende Links enthält.


SuSE-INTERN:

Symptom:

Die in den Verzeichnissen /etc/cron.hourly /etc/cron.daily etc. liegenden Skripten werden von Cron nicht ausgeführt.

Ursache:

Im Script /usr/lib/cron/run-crons, das Cron alle 15 Min. startet und das wiederum die System-Cronjobs aufruft, wird die Differenz zwischen der aktuellen Zeit zum Zeitpunkt der Ausführung und der Zeitmarken der Dateien in /var/cron/lastrun mit Hilfe von find abgefragt. Find hat aber leider einen kleinen Bug in ctime.

Workarounds:

Bis eine neue Version von find verfügbar ist, gibt zwei Möglichkeiten:

1. Möglichkeit

Die Datei /etc/crontab durch folgende ersetzen:
SHELL=/bin/sh
PATH=/usr/bin:/usr/sbin:/sbin:/bin:/usr/lib/news/bin
MAILTO=root

#-* * * * *    root  test -x /usr/sbin/atrun && /usr/sbin/atrun
0 * * * *      root  test -x /usr/sbin/faxqclean && /usr/sbin/faxqclean
5 22 * * *     root  test -x /usr/sbin/texpire && /usr/sbin/texpire
25 23 * * *    root  test -e /usr/sbin/faxcron && sh /usr/sbin/faxcron | mail FaxMaster
45 6 * * *     root  test -x /etc/cron.daily/aaa_base && /etc/cron.daily/aaa_base
50 6 * * *     root  test -x /etc/cron.daily/tetex.cron && /etc/cron.daily/tetex.cron
Achten Sie bitte darauf, daß nur root Schreib- und Leseberechtigung für die Datei /etc/crontab haben sollte. Ändern Sie dies ggf. durch die Eingabe von
chown root.root /etc/crontab
chmod 600 /etc/crontab

2. Möglichkeit

Das Script /usr/lib/cron/run-crons durch folgendes Script ersetzen:
#!/bin/bash
#
# /usr/lib/cron/run-crons
#
#
# Copyright (c) 1998 SuSE GmbH Nuernberg, Germany.  All rights reserved.
#
# Author: Burchard Steinbild , 1998
#
# this script looks into /etc/cron.{hourly,daily,weekly,monthly} for
# scripts to be executed.  The info about last run is stored in
# /var/cron/lastrun
#
# concept similar to debian and redhat
#

mkdir -p /var/cron/lastrun

for CRONDIR in /etc/cron.{hourly,daily,weekly,monthly} ; do
    test -d $CRONDIR || continue
    BASE=${CRONDIR##*/}
    test -e /var/cron/lastrun/$BASE && {
        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" ;;
        esac
        eval find /var/cron/lastrun/$BASE $TIME | \
             xargs --no-run-if-empty rm
    }
    if test ! -e /var/cron/lastrun/$BASE ; then
        touch /var/cron/lastrun/$BASE

        # keep going when something fails
        set +e
        for SCRIPT in $CRONDIR/* ; do
            test -d $SCRIPT && continue
            if test -x $SCRIPT ; then
                $SCRIPT
            fi
        done
    fi
done

#
# now make sure, we have no lastrun files dated to future
#
touch /var/cron/lastrun
find /var/cron/lastrun -newer /var/cron/lastrun | \
             xargs --no-run-if-empty rm

Stichwörter:

Kategorien: Administration

SDB-wey_cron, Copyright SuSE Linux AG, Nürnberg, Germany
Author: sdb@suse.de - Version: 20. Dez 1998
SuSE Linux AG - Zuletzt generiert: 27. Mär 2002 von sdb (sdb_gen 1.40.0)