From ce7db9a8e68943c06ddc9345b92cc134bf9ff7c1 Mon Sep 17 00:00:00 2001 From: Gabriel Augendre Date: Tue, 15 Oct 2024 18:32:42 +0200 Subject: [PATCH] simplify borg sync script --- playbooks/apps/files/bin/borg-sync | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) diff --git a/playbooks/apps/files/bin/borg-sync b/playbooks/apps/files/bin/borg-sync index 218b60d..c4927e4 100755 --- a/playbooks/apps/files/bin/borg-sync +++ b/playbooks/apps/files/bin/borg-sync @@ -4,11 +4,7 @@ SOURCE_DIRECTORY="/mnt/data/nextcloud-aio/backups/borg" RCLONE_CONFIG="borgbase-nextcloud-aio" -TARGET_DIRECTORY="repo" # this is the BorgBase directory name: modify it only if you want to specify a different one (discouraged) - -######################################## -# DO NOT modify any of the following! # -######################################## +TARGET_DIRECTORY="repo" if [ "$EUID" -ne 0 ]; then echo "run as root" @@ -39,19 +35,11 @@ touch "$SOURCE_DIRECTORY/aio-lockfile" if ! rclone sync -v --exclude aio-lockfile "$SOURCE_DIRECTORY/" "$RCLONE_CONFIG:$TARGET_DIRECTORY"; then - if docker ps --format "{{.Names}}" | grep "^nextcloud-aio-nextcloud$"; then - docker exec -en nextcloud-aio-nextcloud bash /notify.sh "Rclone failed." "Failed to synchronise the backup repository with the target directory." - else - echo "Failed to synchronise the backup repository with the target directory." - fi + echo "Failed to synchronise the backup repository with the target directory." rm "$SOURCE_DIRECTORY/aio-lockfile" exit 1 fi rm "$SOURCE_DIRECTORY/aio-lockfile" -if docker ps --format "{{.Names}}" | grep "^nextcloud-aio-nextcloud$"; then - docker exec -en nextcloud-aio-nextcloud bash /notify.sh "Rclone backup successful!" "Synchronised the backup repository successfully." -else - echo "Synchronised the backup repository successfully." -fi +echo "Done"