Benutzer:Heernis/Profil-Sicherung

Aus EnzyklopAtys

Wechseln zu: Navigation, Suche
#!/bin/bash
# Sicherung des Ryzom Profils
# Letzte Aktualisierung 30.03.2019
# Benötigt wird: sudo apt install p7zip-full
# Das Script erstellt bei Ausführung ein monatliche Sicherung. 
# Wenn ein monatliche Sicherung vorhanden, erstellt es ein inkrementelle Sicherung, 
# das nur Veränderungen im Bezug auf die letzte monatliche Sicherung, erstellt.
# Große Dateien, wie Musik, Mods oder Screenshots, können per Exclude-Variabel ausgelassen werden.

TODAY=$(date +%Y-%m-%d-%H:%M:%S)
MONTH=$(date +%d-%m)

DIR1="/data/ryzom_profile_backup" #Verzeichnis wohin gesichert wird
DIR2="~/.local/share/Ryzom" #Verzeichnis der Ryzom Profile
EXCLUDE0="-xr!~/.local/share/Ryzom/mods" #Ausgelassenes Verzeichnis
EXCLUDE1="-xr!~/.local/share/Ryzom/0/music" #Ausgelassenes Verzeichnis
EXCLUDE2="-xr!~/.local/share/Ryzom/0/screenshots" #Ausgelassenes Verzeichnis


echo "Starte Sicherung...." > log.txt
echo " "
#Lösche alle cache-Dateien
find $DIRS -type f -name '*.cache' -exec rm {} \;
find $DIRS -type f -name 'cache.index' -exec rm {} \;
find $DIRS -type f -name 'string_client.pack' -exec rm {} \;
find $DIRS -type f -name '*.string_cache' -exec rm {} \;
find $DIRS -type f -name 'hsts-list.save' -exec rm {} \;
# Ryzom Profil Sicherung
if [ ! -f $DIR1/Ryzom-$MONTH.7z ];
then
echo "Ryzom - Erstelle monatliche Sicherung."
7za a $DIR1/Ryzom-$MONTH.7z $DIR2 -mx=9
else
echo "Ryzom - Erstelle aktuelle Sicherung."
7za u $DIR1/Ryzom-$MONTH $DIR2 -ms=off -mx=9 -t7z -u- -up0q3r2x2y2z0w2!$DIR1/Ryzom-$TODAY.7z $EXCLUDE0 $EXCLUDE1 $EXCLUDE2
fi
echo
echo "Fertig!"