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

Probleme mit crontab



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:

Subject: Cron <root@*******> /backup/bin/backup.sh KW$(date +
/bin/sh: -c: line 1: unexpected EOF while looking for matching `)'
/bin/sh: -c: line 2: syntax error: unexpected end of file

Subject: Cron <root@CTS01> /backup/bin/backup.sh $(date +
/bin/sh: -c: line 1: unexpected EOF while looking for matching `)'
/bin/sh: -c: line 2: syntax error: unexpected end of file

Ich habe die crontab schonmehrfach durchgesehen nach versteckten Zeichen, die sowas verursachen könnten, bin abe rleide rmit meinem Latein am ende. Der Syntax stimmt und sollte funktionieren.

Crontab:
# /etc/crontab: system-wide crontab
# Unlike any other crontab you don't have to run the `crontab'
# command to install the new version when you edit this file.
# This file also has a username field, that none of the other crontabs do.

SHELL=/bin/sh
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
MAILTO=root

# m     h       dom     mon     dow     user    command
17 * * * * root run-parts --report /etc/cron.hourly 25 6 * * * root test -x /usr/sbin/anacron || run-parts --report /etc/cron.daily 47 6 * * 7 root test -x /usr/sbin/anacron || run-parts --report /etc/cron.weekly 52 6 1 * * root test -x /usr/sbin/anacron || run-parts --report /etc/cron.monthly

#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) /



Backup-Script:
#!/bin/sh
tar -czvf /backup/$1.tar.gz --exclude-from=/backup/exclude $2 &>/backup/$1.log

Sieht jemand den fehler? Ich bin ratlos :-(

Thomas Pfaffinger




Reply to: