"Hofer, Elmar (ZKD)" wrote:
In der crontab habe ich folgenden Eintrag:
58 1 25-31 3,10 7 root entsprechende Befehle
Eigentlich sollte dieser Befehl nur zwischen dem 25. und 31. laufen, wenn zusätzlich Sonntag und März oder Oktober ist.
Leider nein, das wäre zu einfach ;-)
Die 25 - 31 wird aber einfach missachtet und so behandelt, als ob dort ein * stehen würde.
Missachtet werden sie nicht, das Kommando wird ausgeführt, wenn entweder ein Sonntag oder der 25.-31. ist.
Was ist hier falsch gelaufen ? Gibt es etwa im crontab Felder, die sich gegenseitig ausschließen ?
Sie schließen sich nicht aus, aber das Zusammenwirken der Felder ist anders, als es viele (mich eingeschlossen) erwarten würden. Wenn Du noch mal einen tiefen Blick in `man 5 crontab` wirfst, wirst Du dort folgendes finden: Note: The day of a command's execution can be specified by two fields -- day of month, and day of week. If both fields are restricted (ie, aren't *), the command will be run when either field matches the current time. For exam<AD> ple, ``30 4 1,15 * 5'' would cause a command to be run at 4:30 am on the 1st and 15th of each month, plus every Friday. Die Lösung für Dein Problem könnte also so aussehen, daß Du im Feld für den Wochentag ein * läßt, so daß das Kommando an allen Tagen im angegebenen Zeitraum ausgeführt wird, und dann aus der crontab nur ein Skript aufrufst, das vor dem Ausführen des eigentlichen Kommandos prüft, ob zusätzlich auch die andere Bedingung (Wochentag) paßt. Sowas wurde vor einiger Zeit hier schon mal diskutiert, müßte also auch im Listenarchiv zu finden sein. Eilert -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Eilert Brinkmann -- Universitaet Bremen -- FB 3, Informatik eilert@informatik.uni-bremen.de - eilert@tzi.org - eilert@linuxfreak.com http://www.informatik.uni-bremen.de/~eilert/