diff options
author | szaimen <szaimen@e.mail.de> | 2021-07-10 10:31:32 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-07-10 10:31:32 +0300 |
commit | ed0c57abddb76c878b97cfcbfe4dc1773f167f6d (patch) | |
tree | 4e449810c5635868bd309b751f58b383b21881be /not-supported | |
parent | c262de4eec2158cef8191386e6abd22e0272b182 (diff) |
Some small enhancements to the backup scripts (#2043)
Signed-off-by: szaimen <szaimen@e.mail.de>
Diffstat (limited to 'not-supported')
-rw-r--r-- | not-supported/borgbackup.sh | 21 | ||||
-rw-r--r-- | not-supported/rsyncbackup.sh | 30 |
2 files changed, 30 insertions, 21 deletions
diff --git a/not-supported/borgbackup.sh b/not-supported/borgbackup.sh index 4f8dc89b..394e7942 100644 --- a/not-supported/borgbackup.sh +++ b/not-supported/borgbackup.sh @@ -647,28 +647,29 @@ then send_error_mail "Some errors were reported during the backup integrity check!" "Backup integrity check" fi -# Rename the snapshot back to normal -if ! re_rename_snapshot -then - send_error_mail "Could not rename the snapshot-pending to snapshot." "Backup integrity check" -fi - -# Print usage of drives into log -show_drive_usage - # Adjust permissions and scrub volume if [ -n "$IS_BTRFS_PART" ] && [ "$BTRFS_SCRUB_BACKUP_DRIVE" = "yes" ] then inform_user "$ICyan" "Scrubbing BTRFS partition..." if ! btrfs scrub start -B "$BACKUP_MOUNTPOINT" then + re_rename_snapshot send_error_mail "Some errors were reported while scrubbing the BTRFS partition." fi fi +# Rename the snapshot back to normal +if ! re_rename_snapshot +then + send_error_mail "Could not rename the snapshot-pending to snapshot." "Backup integrity check" +fi + +# Print usage of drives into log +show_drive_usage + # Unmount the backup drive inform_user "$ICyan" "Unmounting the backup drive..." -if ! umount "$BACKUP_MOUNTPOINT" +if mountpoint -q "$BACKUP_MOUNTPOINT" && ! umount "$BACKUP_MOUNTPOINT" then send_error_mail "Could not unmount the backup drive!" "Backup integrity check" fi diff --git a/not-supported/rsyncbackup.sh b/not-supported/rsyncbackup.sh index de2040f6..79858426 100644 --- a/not-supported/rsyncbackup.sh +++ b/not-supported/rsyncbackup.sh @@ -201,38 +201,46 @@ then send_error_mail "Something failed during the rsync job." fi -# Rename the snapshot back to normal -if ! re_rename_snapshot -then - send_error_mail "Could not rename the snapshot-pending to snapshot." -fi - -# Print usage of drives into log -show_drive_usage - # Adjust permissions and scrub volume if [ -n "$IS_BTRFS_PART" ] then inform_user "$ICyan" "Adjusting permissions..." find "$BACKUP_MOUNTPOINT/" -not -path "$BACKUP_MOUNTPOINT/.snapshots/*" \ \( ! -perm 600 -o ! -group root -o ! -user root \) -exec chmod 600 {} \; -exec chown root:root {} \; + inform_user "$ICyan" "Making sure that all data is written out correctly by waiting 10 min..." + # This fixes an issue where checksums are not yet created before the scrub command runs which then reports checksum errors + if ! sleep 10m + then + re_rename_snapshot + send_error_mail "Some errors were reported while waiting for the data to get written out." + fi inform_user "$ICyan" "Scrubbing BTRFS partition..." if ! btrfs scrub start -B "$BACKUP_MOUNTPOINT" then + re_rename_snapshot send_error_mail "Some errors were reported while scrubbing the BTRFS partition." fi fi +# Rename the snapshot back to normal +if ! re_rename_snapshot +then + send_error_mail "Could not rename the snapshot-pending to snapshot." +fi + +# Print usage of drives into log +show_drive_usage + # Unmount the backup drive inform_user "$ICyan" "Unmounting the off-shore backup drive..." -if ! umount "$BACKUP_MOUNTPOINT" +if mountpoint -q "$BACKUP_MOUNTPOINT" && ! umount "$BACKUP_MOUNTPOINT" then send_error_mail "Could not unmount the off-shore backup drive!" fi # Unmount the backup drive inform_user "$ICyan" "Unmounting the daily backup drive..." -if ! umount "$BACKUP_SOURCE_MOUNTPOINT" +if mountpoint -q "$BACKUP_SOURCE_MOUNTPOINT" && ! umount "$BACKUP_SOURCE_MOUNTPOINT" then send_error_mail "Could not unmount the daily backup drive!" fi |