echo -n `date` >&2
printf " $computer: $computer:$filesystem $backuplevel backup\n" >&2
+ SNARFILE="${storagedir}/${computer}/${sfilesystem}/.incremental.snar"
+ incrementalsnar="/root/.backup/${sfilesystem}.snar"
if [ "$backuplevel" = "daglig" ]
then
- lastd=`cat ../.date`
- lastcmd="--newer='$lastd'"
+ # If incremental backup, we need to copy the incremental status to $computer.
+ # If it does not exist, whine a bit and then run date-based instead.
+ if [ -s "$SNARFILE" ]; then
+ if ! scp $SNARFILE root@$computer:$incrementalsnar; then
+ echo `date`" $computer: Could not copy .incremental.snar to $computer"
+ die
+ fi
+ lastcmd="--listed-incremental=$incrementalsnar --no-check-device"
+ else
+ echo `date`" $computer: Missing incremental.snar for $filesystem, doing date-based backup instead until next full backup" >&2
+ incrementalsnar=""
+ lastd=`cat ../.date`
+ lastcmd="--newer='$lastd'"
+ fi
else
- lastcmd=""
+ lastcmd="--listed-incremental=$incrementalsnar"
fi
# expand the exclude-path for use with tar
if [ $? -eq 0 ] && [ -s $TARFILE ]; then
# File is >0 in size and neither cat or tar tzvf failed; we assume it worked.
+ if ! scp root@$computer:$incrementalsnar $SNARFILE.tmp; then
+ echo `date`" $computer: Could not copy .incremental.snar from $computer"
+ die
+ fi
+
# Move tar file in place
mv $TARFILE $DATE.tgz
+ mv $SNARFILE.tmp $SNARFILE
# Update timestamp
echo $DATEs > ../.date && touch -t $DATE ../.date