Mutual GNU / Linux


Translating Bash Script to Windows and Mac

Mac Script
#!/bin/bash
# Erstellt von Heernis
# 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="/Users/$USER/Library/Application Support/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 im Profil 0 auslassen
#EXCLUDE2="-xr!/home/$USER/.local/share/Ryzom/0/screenshots& quot; #Bildschirmaufnahmen im Profil 0 auslassen

#EXCLUDE3="-xr!*.tga -xr!*.png -xr!*.jpeg -xr!*.jpg -xr!*.gif" #Alle Bilder auslassen
#EXCLUDE4="-xr!*.mp3 -xr!*.ogg -xr!*.wav" #Alle Audio-Dateien auslassen

#EXCLUDE5="-xr!*.dds -xr!*.shape -xr!*.anim -xr!*.ps -xr!*.anim" #Alle Modifikationen auslassen

#EXCLUDE6="-xr!*.cache -xr!*.index -xr!*.string_client.pack -xr!*.string_cache -xr!hsts-list.save" #Cache auslassen
#EXCLUDE7="-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 $EXCLUDE5 $EXCLUDE6 $EXCLUDE7
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 $EXCLUDE5 $EXCLUDE6 $EXCLUDE7
fi
echo
echo "Fertig!"

---



Show topic
Last visit Tuesday, 16 April 04:04:14 UTC
P_:

powered by ryzom-api