Benutzer:Heernis/Profil-Sicherung: Unterschied zwischen den Versionen

Aus EnzyklopAtys

Wechseln zu: Navigation, Suche
K
K
Zeile 10: Zeile 10:
  
 
TODAY=$(date +%Y-%m-%d-%H:%M:%S)
 
TODAY=$(date +%Y-%m-%d-%H:%M:%S)
MONTH=$(date +%d-%m)
+
MONTH=$(date +%Y-%m)
  
 +
#Verzeichnisse
 
DIR1="/data/ryzom_profile_backup" #Verzeichnis wohin gesichert wird
 
DIR1="/data/ryzom_profile_backup" #Verzeichnis wohin gesichert wird
 
DIR2="/home/$USER/.local/share/Ryzom" #Verzeichnis der Ryzom Profile
 
DIR2="/home/$USER/.local/share/Ryzom" #Verzeichnis der Ryzom Profile
EXCLUDE0="-xr!/home/$USER/.local/share/Ryzom/mods" #Ausgelassenes Verzeichnis
 
EXCLUDE1="-xr!/home/$USER/.local/share/Ryzom/0/music" #Ausgelassenes Verzeichnis
 
EXCLUDE2="-xr!/home/$USER/.local/share/Ryzom/0/screenshots" #Ausgelassenes Verzeichnis
 
EXCLUDE3="-x!*.cache -x!cache.index -x!*string_client.pack -x!*.string_cache -x!hsts-list.save" #Ausgelassene Dateien
 
  
echo "Starte Sicherung...." > log.txt
+
#Ausgeschlossene Verzeichnisse und Dateien
 +
#EXCLUDE0="-xr!/home/$USER/.local/share/Ryzom/mods" #Modifikationen auslassen
 +
#EXCLUDE1="-xr!/home/$USER/.local/share/Ryzom/0/music" #Musik auslassen
 +
#EXCLUDE2="-xr!/home/$USER/.local/share/Ryzom/0/screenshots" #Bildschirmaufnahmen auslassen
 +
#EXCLUDE3="-xr!*.cache -xr!*.index -xr!*string_client.pack -xr!*.string_cache -xr!hsts-list.save" #Cache auslassen
 +
#EXCLUDE4="-xr!*.dmg -xr!*.log" #Log und Debug auslassen
 +
 
 +
#Komprimierungslevel
 +
LEVEL="9" #Möglich ist 9 für Ultra bis 1 für Minimal
 +
 
 +
echo "Starte Sicherung...."
 
echo " "
 
echo " "
#Lösche alle cache-Dateien (optional). Entferne #, wenn gewünscht.  
+
 
 +
#Lösche alle Cache-Dateien (optional). Entferne #, wenn gewünscht.  
 
#find $DIR2 -type f -name '*.cache' -exec rm {} \;
 
#find $DIR2 -type f -name '*.cache' -exec rm {} \;
 
#find $DIR2 -type f -name 'cache.index' -exec rm {} \;
 
#find $DIR2 -type f -name 'cache.index' -exec rm {} \;
Zeile 27: Zeile 35:
 
#find $DIR2 -type f -name '*.string_cache' -exec rm {} \;
 
#find $DIR2 -type f -name '*.string_cache' -exec rm {} \;
 
#find $DIR2 -type f -name 'hsts-list.save' -exec rm {} \;
 
#find $DIR2 -type f -name 'hsts-list.save' -exec rm {} \;
 +
 +
#Lösche Log und Debug Dateien (optional). Entferne #, wenn gewünscht.
 +
#find $DIR2 -type f -name '*.log' -exec rm {} \;
 +
#find $DIR2 -type f -name '*.dmg' -exec rm {} \;
 +
 
# Ryzom Profil Sicherung
 
# Ryzom Profil Sicherung
 
if [ ! -f $DIR1/Ryzom-$MONTH.7z ];
 
if [ ! -f $DIR1/Ryzom-$MONTH.7z ];
 
then
 
then
 
echo "Ryzom - Erstelle monatliche Sicherung."
 
echo "Ryzom - Erstelle monatliche Sicherung."
7za a $DIR1/Ryzom-$MONTH.7z $DIR2 -mx=9 $EXCLUDE3
+
7za a $DIR1/Ryzom-$MONTH.7z $DIR2 -mx=$LEVEL $EXCLUDE1 $EXCLUDE2 $EXCLUDE3 $EXCLUDE4
 +
fi$EXCLUDE3  
 
else
 
else
 
echo "Ryzom - Erstelle aktuelle Sicherung."
 
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 $EXCLUDE3
+
7za u $DIR1/Ryzom-$MONTH $DIR2 -ms=off -mx=$LEVEL -t7z -u- -up0q3r2x2y2z0w2!$DIR1/Ryzom-$TODAY.7z $EXCLUDE1 $EXCLUDE2 $EXCLUDE3 $EXCLUDE4
 
fi
 
fi
 
echo
 
echo
 
echo "Fertig!"
 
echo "Fertig!"
 
</syntaxhighlight>
 
</syntaxhighlight>

Version vom 31. März 2019, 15:21 Uhr

#!/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 +%Y-%m)

#Verzeichnisse
DIR1="/data/ryzom_profile_backup" #Verzeichnis wohin gesichert wird
DIR2="/home/$USER/.local/share/Ryzom" #Verzeichnis der Ryzom Profile

#Ausgeschlossene Verzeichnisse und Dateien
#EXCLUDE0="-xr!/home/$USER/.local/share/Ryzom/mods" #Modifikationen auslassen
#EXCLUDE1="-xr!/home/$USER/.local/share/Ryzom/0/music" #Musik auslassen
#EXCLUDE2="-xr!/home/$USER/.local/share/Ryzom/0/screenshots" #Bildschirmaufnahmen auslassen
#EXCLUDE3="-xr!*.cache -xr!*.index -xr!*string_client.pack -xr!*.string_cache -xr!hsts-list.save" #Cache auslassen
#EXCLUDE4="-xr!*.dmg -xr!*.log" #Log und Debug auslassen

#Komprimierungslevel
LEVEL="9" #Möglich ist 9 für Ultra bis 1 für Minimal

echo "Starte Sicherung...."
echo " "

#Lösche alle Cache-Dateien (optional). Entferne #, wenn gewünscht. 
#find $DIR2 -type f -name '*.cache' -exec rm {} \;
#find $DIR2 -type f -name 'cache.index' -exec rm {} \;
#find $DIR2 -type f -name 'string_client.pack' -exec rm {} \;
#find $DIR2 -type f -name '*.string_cache' -exec rm {} \;
#find $DIR2 -type f -name 'hsts-list.save' -exec rm {} \;

#Lösche Log und Debug Dateien (optional). Entferne #, wenn gewünscht. 
#find $DIR2 -type f -name '*.log' -exec rm {} \;
#find $DIR2 -type f -name '*.dmg' -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=$LEVEL $EXCLUDE1 $EXCLUDE2 $EXCLUDE3 $EXCLUDE4 
fi$EXCLUDE3 
else
echo "Ryzom - Erstelle aktuelle Sicherung."
7za u $DIR1/Ryzom-$MONTH $DIR2 -ms=off -mx=$LEVEL -t7z -u- -up0q3r2x2y2z0w2!$DIR1/Ryzom-$TODAY.7z $EXCLUDE1 $EXCLUDE2 $EXCLUDE3 $EXCLUDE4 
fi
echo
echo "Fertig!"