[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Probleme mit crontab



Hallo Thomas,

Am 2005-11-23 10:30:21, schrieb Thomas Pfaffinger:
> Hallo @ all,
> ich habe bei mir ein Backup-Script mit tar am laufen. Wenn ich das 
> Script manuell aufrufe, klappt alles ohne Probleme. Sobald ich das 
> Script aber per cron aufrufen lasse, bekome ich immer eine systemmail:

> #Datenbankbackup, Montag-Freitag von 7 bis 18 Uhr alle 5 Minuten
> */5 7-17 *    *    1-5 root /backup/bin/dbdump.sh
> 
> #Tagesbackup
> 00  22   2-31 *    1-4 root /backup/bin/backup.sh $(date +%A) /
                                                                ^
                                                                ?
> #Wochenbackup
> 00  22   2-31 *    5   root /backup/bin/backup.sh KW$(date +%V) /
                                                                  ^
                                                                  ?
> #Monatsbackup
> 00  22   1    2-12 *   root /backup/bin/backup.sh $(date +%Y-%B) /
                                                                   ^
                                                                   ?
> #Jahresbackup
> 00  22   1    1    *   root /backup/bin/backup.sh $(date +Y) /
                                                            ^  ^
                                                            %  ?

Es ist eben ein crontab und kein Script.
Warum nimmste nicht einfach einen normalen Parameter wie

        backup.sh daily
        backup.sh weekly
        backup.sh monthly
        backup.sh yearly

und fügst in Dein Script folgendes ein:

if   [ "$1" == "dayly"   ] ; then DATE=`date +%A` ; 
elif [ "$1" == "weekly"  ] ; then DATE=`date +%V` ; 
elif [ "$1" == "monthly" ] ; then DATE=`date +%Y-%B` ; 
elif [ "$1" == "yearly"  ] ; then DATE=`date +%Y` ; 
else
     echo "Fehler: Keine Periode angegeben."
     exit 1
fi

> Sieht jemand den fehler? Ich bin ratlos :-(
> 
> Thomas Pfaffinger


Greetings
Michelle

-- 
Linux-User #280138 with the Linux Counter, http://counter.li.org/
Michelle Konzack   Apt. 917                  ICQ #328449886
                   50, rue de Soultz         MSM LinuxMichi
0033/3/88452356    67100 Strasbourg/France   IRC #Debian (irc.icq.com)



Reply to: