Raffael Schmid wrote:
ich habe folgende Crontab-Einträge:
0 0 1-7 * mon,tue,wed,thu,fri,sat /usr/sbin/backup.sh inc SEserver 0 0 1-7 * sun /usr/sbin/backup.sh full SEserver 0 0 8-31 * * /usr/sbin/backup.sh inc SEserver
Jetzt ist das backup-Script 2x ausgeführt worden diese Nacht. Der Crontab kam zum ersten Mal zum Zug.
Warum? Ich sege den Fehler nicht....
man 5 crontab: ... Commands are executed by cron when the minute, hour and month of the year fields match the current time, _and_ at least one of the two day fields (day of the month, or day of week) macht the current time. Also: Zeile 1 wird _jeden_ Montag bis Samstag und zusätzlich jeden 1.-7. des Monats ausgeführt usw. In Deinem Fall (gestern) hat also Zeile 1 (wegen Wochentag) und Zeile 3 (wegen day of month) zugeschlagen. Du möchstest IMO jeden Tag ein "incrementel backup" machen ausser am ersten Sonntag im Monat, oder? Ich würde das im Skript steuern; etwa so in der Art: --- cut here --- weekday=$(LANG=C date '+%a') day_of_month=$(LANG=C date '+%d') if [[ $day_of_month = "Sun" && $weekday -le 7 ]]; #we are on a sunday, it's the first-seventh of month so full backup INCTYPE="full" else INCTYPE="inc" fi --- cut here --- und in der Crontab nur noch einen Eintrag lassen. Alternative: in crontab: 0 0 * * sun if [ `/bin/date '+%d` -le 7 ]; then /usr/sbin/backup.sh full SEserver; else /usr/sbin/backup.sh inc SEserver;fi 0 0 * * mon,tue,wed,thu,fri,sat /usr/sbin/backup.sh inc SEserver (ungestestet; auf unserer SUN hier geht so was!) Andreas