#!/bin/sh
#
# Datei: backup.5
# Autor: Holger Klawitter <info@klawitter.de>
# Datum: 2001-10-23
#
# Erstellung von Backups andhand von Positiv- und Negativlisten.
#

modus="$1"
backupdir=/home/holger/Vortrag/backups

jaliste="$backupdir/config/$modus.ja"
neinliste="$backupdir/config/$modus.nein"

if test ! -r "$jaliste"
then
	echo "Datei $jaliste nicht gefunden."
	exit 1
fi

datum="`date +%Y-%m-%d`"
backupdatei="$backupdir/data/$modus.$datum.tgz"

if test -r "$neinliste"
then
	exclude="--exclude-from=$neinliste"
fi

find . -name "*~" -exec rm -f {} ";"

tar -cz \
	$exclude \
	--files-from $jaliste \
	-f "$backupdatei"

if test "$?" != 0
then
	echo "Problem beim Backup von $modus"
	exit 1
fi

echo "Fertig"

