fix
This commit is contained in:
@@ -4,14 +4,15 @@ source TalkLib.sh
|
|||||||
# --- KONFIGURATION ---
|
# --- KONFIGURATION ---
|
||||||
# Pfad zum lokalen Verzeichnis (Wichtig: Schrägstrich am Ende!)
|
# Pfad zum lokalen Verzeichnis (Wichtig: Schrägstrich am Ende!)
|
||||||
SOURCE_DIR_DATA="/mnt/data/"
|
SOURCE_DIR_DATA="/mnt/data/"
|
||||||
SOURCE_DIR_APP="/var/www/html"
|
SOURCE_DIR_APP="/var/www/html/"
|
||||||
|
SOURCE_DIR_DB="/root/backupDB/"
|
||||||
# Remote-Zugangsdaten
|
# Remote-Zugangsdaten
|
||||||
REMOTE_USER="backupuser"
|
REMOTE_USER="backupuser"
|
||||||
REMOTE_HOST="alsdorf.spznord.de"
|
REMOTE_HOST="alsdorf.spznord.de"
|
||||||
REMOTE_PORT="1022" # Neuer Port für die Übertragung
|
REMOTE_PORT="1022" # Neuer Port für die Übertragung
|
||||||
REMOTE_DIR_DATA="/mnt/disk0/backups/nextcloud/data/"
|
REMOTE_DIR_DATA="/mnt/disk0/backups/nextcloud/data/"
|
||||||
REMOTE_DIR_APP="/mnt/disk0/backups/nextcloud/App/"
|
REMOTE_DIR_APP="/mnt/disk0/backups/nextcloud/App/"
|
||||||
|
REMOTE_DIR_DB="/mnt/disk0/backups/nextcloud/DB/"
|
||||||
|
|
||||||
#nextcloud-Zugangsdaten
|
#nextcloud-Zugangsdaten
|
||||||
NC_URL="https://cloud.ptv-euregio.de"
|
NC_URL="https://cloud.ptv-euregio.de"
|
||||||
@@ -23,7 +24,7 @@ Mesg="*** Nextcloud Data Backup ***${NEWLINE}"
|
|||||||
|
|
||||||
|
|
||||||
# --- LOGIK ---
|
# --- LOGIK ---
|
||||||
echo "Starte Synchronisation von $SOURCE_DIR_DATA nach $REMOTE_HOST auf Port $REMOTE_PORT..." > $logfilename
|
echo "Starte Synchronisation von $SOURCE_DIR_DATA nach $REMOTE_HOST auf Port $REMOTE_PORT..." #> $logfilename
|
||||||
# Pfad zum SSH-Key
|
# Pfad zum SSH-Key
|
||||||
SSH_KEY="/root/.ssh/id_ed25519"
|
SSH_KEY="/root/.ssh/id_ed25519"
|
||||||
|
|
||||||
@@ -36,7 +37,7 @@ logNCFilename="nextcloud-data-backup_$(date +"%Y%m%d%H%M")_log.txt"
|
|||||||
rsync -avzh \
|
rsync -avzh \
|
||||||
-e "ssh -p $REMOTE_PORT -i $SSH_KEY" \
|
-e "ssh -p $REMOTE_PORT -i $SSH_KEY" \
|
||||||
--exclude 'nextcloud.log' \
|
--exclude 'nextcloud.log' \
|
||||||
--exclude 'nextcloud.log.1' \$
|
--exclude 'nextcloud.log.1' \
|
||||||
--exclude 'audit.log' \
|
--exclude 'audit.log' \
|
||||||
--exclude 'audit.log.1' \
|
--exclude 'audit.log.1' \
|
||||||
--exclude 'updater.log' \
|
--exclude 'updater.log' \
|
||||||
@@ -44,7 +45,7 @@ rsync -avzh \
|
|||||||
--exclude 'flow.log' \
|
--exclude 'flow.log' \
|
||||||
--exclude 'flow.log.1' \
|
--exclude 'flow.log.1' \
|
||||||
--progress \
|
--progress \
|
||||||
"$SOURCE_DIR_DATA" "$REMOTE_USER@$REMOTE_HOST:$REMOTE_DIR_DATA" >> $logfilename
|
"$SOURCE_DIR_DATA" "$REMOTE_USER@$REMOTE_HOST:$REMOTE_DIR_DATA"
|
||||||
|
|
||||||
# Status prüfen
|
# Status prüfen
|
||||||
if [ $? -eq 0 ]; then
|
if [ $? -eq 0 ]; then
|
||||||
@@ -61,7 +62,8 @@ echo "Starte Synchronisation von $SOURCE_DIR_APP nach $REMOTE_HOST auf Port $REM
|
|||||||
rsync -avzh \
|
rsync -avzh \
|
||||||
-e "ssh -p $REMOTE_PORT -i $SSH_KEY" \
|
-e "ssh -p $REMOTE_PORT -i $SSH_KEY" \
|
||||||
--progress \
|
--progress \
|
||||||
"$SOURCE_DIR_APP" "$REMOTE_USER"@"$REMOTE_HOST:$REMOTE_DIR_APP" >> $logfilename
|
--exclude 'tmp' \
|
||||||
|
"$SOURCE_DIR_APP" "$REMOTE_USER"@"$REMOTE_HOST:$REMOTE_DIR_APP"
|
||||||
|
|
||||||
# Status prüfen
|
# Status prüfen
|
||||||
if [ $? -eq 0 ]; then
|
if [ $? -eq 0 ]; then
|
||||||
@@ -70,6 +72,18 @@ else
|
|||||||
Mesg="${Mesg}Nextcloud App rsync failed.${NEWLINE}"
|
Mesg="${Mesg}Nextcloud App rsync failed.${NEWLINE}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
#Backup Database
|
||||||
|
rsync -avzh \
|
||||||
|
-e "ssh -p $REMOTE_PORT -i $SSH_KEY" \
|
||||||
|
--progress \
|
||||||
|
"$SOURCE_DIR_DB" "$REMOTE_USER"@"$REMOTE_HOST:$REMOTE_DIR_DB"
|
||||||
|
#check status
|
||||||
|
if [ $? -eq 0 ]; then
|
||||||
|
Mesg="${Mesg}Nextcloud DB rsync Ok.${NEWLINE}"
|
||||||
|
else
|
||||||
|
Mesg="${Mesg}Nextcloud DB rsync failed.${NEWLINE}"
|
||||||
|
fi
|
||||||
|
|
||||||
MesgID=$(sendMessage2Room $NC_URL $NC_USER $NC_APP_PASSWORD $ROOM_TOKEN "$Mesg")
|
MesgID=$(sendMessage2Room $NC_URL $NC_USER $NC_APP_PASSWORD $ROOM_TOKEN "$Mesg")
|
||||||
sendFile2Room $NC_URL $NC_USER $NC_APP_PASSWORD $ROOM_TOKEN $logfilename $logNCFilename
|
#sendFile2Room $NC_URL $NC_USER $NC_APP_PASSWORD $ROOM_TOKEN $logfilename $logNCFilename
|
||||||
rm $logfilename
|
rm $logfilename
|
||||||
|
|||||||
Reference in New Issue
Block a user