X
xmarcusx
Mitglied
problem mit backup shell-script
hallo! ich habe ein script für meine backups im netz gefunden, jedoch kommt immer die fehlermeldung:
ich habe mir das script schon mal selbst angeschaut, aber ich kann den fehler einfach nicht finden!
liegt es vielleicht an dieser variable?
hier das skript:
danke schon mal im voraus!
hallo! ich habe ein script für meine backups im netz gefunden, jedoch kommt immer die fehlermeldung:
Code:
/bin/tar: invalid option -- ?
ich habe mir das script schon mal selbst angeschaut, aber ich kann den fehler einfach nicht finden!
liegt es vielleicht an dieser variable?
Code:
NEWER="" # For incremental backups
hier das skript:
Code:
#!/bin/sh
# full and incremental backup script
# created 07 February 2000
# Based on a script by Daniel O?Callaghan <d?@freebsd.org>
# and modified by Gerhard Mourani <gmour?@videotron.ca>
# and by Kevin Pfeiffer <kevin-pfeif?@gmx.de> - 16 March 2003
# Filename: backup.cron
# Script should live in /etc/cron.daily (for example)
#Change the 6 variables below to fit your computer/backup
COMPUTER=luzifer
# name of this computer
DIRECTORIES="/home/amarhe/download /home/amarhe/Documents"
# directories to backup (separate with spaces)
BACKUPDIR=/home/amarhe/mnt/SUN/Ablage/_Backup/Daten
# where to store the backups
TIMEDIR=$BACKUPDIR/last-full
# where to store date of last full backup
TAR=/bin/tar
# name and location of tar
GZIP=/bin/gzip
# name and location of gzip
#You should not have to change anything below here
umask 026 # Files should only be readable by root
PATH=/usr/local/bin:/usr/bin:/bin
DOW=`date +%a` # Day of the week e.g. Mon
DOM=`date +%d` # Date of the Month e.g. 27
DM=`date +%d%b` # Date and Month e.g. 27Sep
NOW=`date +%d-%b` # Today?s date for date file e.g. 27-Sep
NEWER="" # For incremental backups
# On the 1st of the month a permanent full backup is made.
# Every Sunday a full backup is made - overwriting last Sunday?s backup.
# The rest of the time an incremental backup is made. Each incremental
# backup overwrites last week?s incremental backup of the same name.
# Check for existence of directories, date file, etc and create any that are missing.
[ -d "$BACKUPDIR" ] || mkdir $BACKUPDIR
[ -d "$TIMEDIR" ] || mkdir $TIMEDIR
[ -r "$TIMEDIR/$COMPUTER-full-date" ] || touch $TIMEDIR/$COMPUTER-full-date
# Monthly full backup
if [ "$DOM" = "01" ]; then
BACKUP=$BACKUPDIR/$COMPUTER-$DM
$TAR -cf $BACKUP.tar $DIRECTORIES
# Compress monthly backup and remove original tar
$GZIP $BACKUP.tar
fi
# Weekly full backup, compress, and overwrite last Sunday?s
if [ "$DOW" = "Sun" ]; then
# Update full backup date
echo $NOW > $TIMEDIR/$COMPUTER-full-date
BACKUP=$BACKUPDIR/$COMPUTER-$DOW
$TAR -cf $BACKUP.tar $DIRECTORIES
# Compress weekly full backup
$GZIP -f $BACKUP.tar
# Make incremental backup - overwrite last week?s
else
# Get date of last full backup
FULLDATE="`cat $TIMEDIR/$COMPUTER-full-date`"
# Do a full backup if none exists
if [ -z "$FULLDATE" ]; then
echo $NOW > $TIMEDIR/$COMPUTER-full-date
NEWER=""
else
NEWER="?newer $FULLDATE"
fi
$TAR $NEWER -cf $BACKUPDIR/$COMPUTER-$DOW.tar $DIRECTORIES
fi
### end of script ###
danke schon mal im voraus!
Zuletzt bearbeitet: