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

Aus EnzyklopAtys

Wechseln zu: Navigation, Suche
(Bash Script Profil Sicherung hinzugefügt)
 
K
Zeile 3: Zeile 3:
 
# Sicherung des Ryzom Profils
 
# Sicherung des Ryzom Profils
 
# Letzte Aktualisierung 30.03.2019
 
# 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)
 
TODAY=$(date +%Y-%m-%d)
Zeile 11: Zeile 16:
 
EXCLUDE0="-xr!~/.local/share/Ryzom/mods" #Ausgelassenes Verzeichnis
 
EXCLUDE0="-xr!~/.local/share/Ryzom/mods" #Ausgelassenes Verzeichnis
 
EXCLUDE1="-xr!~/.local/share/Ryzom/0/music" #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 "Starte Sicherung...." > log.txt
 
echo " "
 
echo " "
 
#Lösche alle cache-Dateien
 
#Lösche alle cache-Dateien
find $DIR2 -type f -name '*.cache' -exec rm {} \;
+
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
 
# Ryzom Profil Sicherung
 
if [ ! -f $DIR1/Ryzom-$MONTH.7z ];
 
if [ ! -f $DIR1/Ryzom-$MONTH.7z ];
Zeile 22: Zeile 33:
 
7za a $DIR1/Ryzom-$MONTH.7z $DIR2 -mx=9
 
7za a $DIR1/Ryzom-$MONTH.7z $DIR2 -mx=9
 
else
 
else
echo "Ryzom - Erstelle akutelle Sicherung."
+
echo "Ryzom - Erstelle aktuelle Sicherung."
7za u $DIR1/www-$MONTH $DIR2 -ms=off -mx=9 -t7z -u- -up0q3r2x2y2z0w2!$DIR1/Ryzom-$TODAY.7z $EXCLUDE0 $EXCLUDE1
+
7za u $DIR1/Ryzom-$MONTH $DIR2 -ms=off -mx=9 -t7z -u- -up0q3r2x2y2z0w2!$DIR1/Ryzom-$TODAY.7z $EXCLUDE0 $EXCLUDE1
 
fi
 
fi
 
echo
 
echo
 
echo "Fertig!"
 
echo "Fertig!"
 
</syntaxhighlight>
 
</syntaxhighlight>

Version vom 30. März 2019, 18:14 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)
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
fi
echo
echo "Fertig!"