improve rsyncbackup script (#2269)

Signed-off-by: szaimen <szaimen@e.mail.de>
This commit is contained in:
Simon L 2022-04-03 12:36:49 +02:00 committed by GitHub
parent f7f5ea6b85
commit dedc5406b8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 23 additions and 23 deletions

View File

@ -197,6 +197,11 @@ then
done
fi
# Export default values
export BORG_PASSPHRASE="$ENCRYPTION_KEY"
export BORG_UNKNOWN_UNENCRYPTED_REPO_ACCESS_IS_OK=yes
export BORG_RELOCATED_REPO_ACCESS_IS_OK=yes
# Skip daily backup creation if needed
if [ -z "$SKIP_DAILY_BACKUP_CREATION" ]
then
@ -372,11 +377,6 @@ Please don't restart or shutdown your server until then!"
# https://iwalton.com/wiki/#[[Backup%20Script]]
# https://decatec.de/linux/backup-strategie-fuer-linux-server-mit-borg-backup/
# Export default values
export BORG_PASSPHRASE="$ENCRYPTION_KEY"
export BORG_UNKNOWN_UNENCRYPTED_REPO_ACCESS_IS_OK=yes
export BORG_RELOCATED_REPO_ACCESS_IS_OK=yes
# Log Borg version
borg --version

View File

@ -94,6 +94,14 @@ get_expiration_time() {
exec > >(tee -i "$LOG_FILE")
exec 2>&1
# Send mail that backup was started
if ! send_mail "Off-shore backup started!" "You will be notified again when the backup is finished!
Please don't restart or shutdown your server until then!"
then
notify_admin_gui "Off-shore backup started!" "You will be notified again when the backup is finished!
Please don't restart or shutdown your server until then!"
fi
# Start backup
inform_user "$IGreen" "Off-shore backup started! $CURRENT_DATE_READABLE"
@ -133,16 +141,6 @@ then
send_error_mail "Not even one daily backup was successfully created. Please wait for that first."
fi
# Check daily backup
rm -f /tmp/DAILY_BACKUP_CHECK_SUCCESSFUL
export SKIP_DAILY_BACKUP_CREATION=1
bash "$SCRIPTS/daily-borg-backup.sh"
if ! [ -f "/tmp/DAILY_BACKUP_CHECK_SUCCESSFUL" ]
then
send_error_mail "Daily backup check failed!" \
"Backup check was unsuccessful! $(date +%T)"
fi
# Prepare backup repository
inform_user "$ICyan" "Mounting the daily backup drive..."
if ! [ -d "$BACKUP_SOURCE_DIRECTORY" ]
@ -165,6 +163,16 @@ then
fi
fi
# Check daily backup
rm -f /tmp/DAILY_BACKUP_CHECK_SUCCESSFUL
export SKIP_DAILY_BACKUP_CREATION=1
bash "$SCRIPTS/daily-borg-backup.sh"
if ! [ -f "/tmp/DAILY_BACKUP_CHECK_SUCCESSFUL" ]
then
send_error_mail "Daily backup check failed!" \
"Backup check was unsuccessful! $(date +%T)"
fi
# Test if btrfs volume
if grep " $BACKUP_MOUNTPOINT " /etc/mtab | grep -q btrfs
then
@ -178,14 +186,6 @@ then
done
fi
# Send mail that backup was started
if ! send_mail "Off-shore backup started!" "You will be notified again when the backup is finished!
Please don't restart or shutdown your server until then!"
then
notify_admin_gui "Off-shore backup started!" "You will be notified again when the backup is finished!
Please don't restart or shutdown your server until then!"
fi
# Check if pending snapshot is existing and cancel the backup in this case.
if does_snapshot_exist "NcVM-snapshot-pending"
then