From af5c53dbc066eb9f5133386dac0a7072eb4ecb13 Mon Sep 17 00:00:00 2001
From: Joel Grunbaum <joelgrun@gmail.com>
Date: Thu, 11 Mar 2021 07:48:14 +0000
Subject: [PATCH] Excludes in own variable, exclude backups

---
 backup.sh |   21 ++++++++++-----------
 1 files changed, 10 insertions(+), 11 deletions(-)

diff --git a/backup.sh b/backup.sh
index 13d1dc8..83a2b73 100755
--- a/backup.sh
+++ b/backup.sh
@@ -2,8 +2,9 @@
 
 BACKUP_DIR="/backup/work/"
 FILES_DIR="/home/joel/OneDrive/"
-RCLONE_BACKUP=("OneDrive_Personal" "GoogleDrive" "Mega" "unimelb" "sout" "pCloud" "gdrive_unimelb")
-RCLONE_FILES=("sout" "Mega" "unimelb" "gdrive_unimelb")
+RCLONE_BACKUP=("GoogleDrive" "Mega" "unimelb" "pCloud" "gdrive_unimelb" "NC_home" "NextCloud")
+RCLONE_FILES=("Mega" "unimelb" "gdrive_unimelb" "NC_home")
+EXCLUDES="--exclude '*~' --exclude '*#*' --exclude '.DS_Store' --exclude '*.7z' "
 
 function sync() {
 	case $1 in
@@ -47,29 +48,27 @@
 	sync_all p
 	exit
 elif [ "$1" = "cron" ]; then
-	borg create \
+    borg create \
 	 --compression zstd,22 \
-	 --exclude '*~' \
-	 --exclude '*#*' \
+	 $EXCLUDES \
 	 \
 	 $BACKUP_DIR::"$(date +%F+%R)" \
 	 $FILES_DIR
 else
-	borg create \
+    borg create \
 	 --verbose \
 	 --stats \
 	 --compression zstd,22 \
-	 --exclude '*~' \
-	 --exclude '*#*' \
+	 $EXCLUDES \
 	 \
 	 $BACKUP_DIR::"$(date +%F+%R)" \
 	 $FILES_DIR
 fi
 
 borg prune \
-	 --keep-hourly 24 \
-	 --keep-daily 7 \
-	 --keep-monthly 4 \
+	 --keep-hourly 12 \
+	 --keep-daily 8 \
+	 --keep-monthly 2 \
 	 $BACKUP_DIR
 
 LAST="$(borg list $BACKUP_DIR | tail -n2 | cut -d' ' -f1)"

--
Gitblit v1.9.3