mirror of https://github.com/Chizi123/Scripts.git

Joel Grunbaum
2021-08-24 d6e801a44971f9e6ee6d1282b3ae0912e0033ba3
Updated to excludes file
1 files modified
1 files added
19 ■■■■■ changed files
backup.sh 16 ●●●● patch | view | raw | blame | history
backup_patterns.txt 3 ●●●●● patch | view | raw | blame | history
backup.sh
@@ -2,9 +2,9 @@
BACKUP_DIR="/backup/work/"
FILES_DIR="/home/joel/OneDrive/"
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' "
RCLONE_BACKUP=("GoogleDrive" "Mega" "unimelb" "pCloud" "gdrive_unimelb")
RCLONE_FILES=("Mega" "unimelb" "gdrive_unimelb")
EXCLUDES="/home/joel/Scripts/backup_patterns.txt"
function sync() {
    case $1 in
@@ -41,8 +41,6 @@
    fi
}
cd /home/joel/OneDrive
if [ "$1" = "sync" ]; then
    echo -e '\033[0;32m'Syncing'\033[0m'
    sync_all p
@@ -50,7 +48,7 @@
elif [ "$1" = "cron" ]; then
    borg create \
     --compression zstd,22 \
     $EXCLUDES \
     --exclude-from $EXCLUDES \
     \
     $BACKUP_DIR::"$(date +%F+%R)" \
     $FILES_DIR
@@ -59,7 +57,7 @@
     --verbose \
     --stats \
     --compression zstd,22 \
     $EXCLUDES \
     --exclude-from $EXCLUDES \
     \
     $BACKUP_DIR::"$(date +%F+%R)" \
     $FILES_DIR
@@ -72,7 +70,9 @@
     $BACKUP_DIR
LAST="$(borg list $BACKUP_DIR | tail -n2 | cut -d' ' -f1)"
if [ -z "$(borg diff $BACKUP_DIR::$(echo $LAST | cut -d' ' -f1) $(echo $LAST | cut -d' ' -f2))" ]; then
TOP="$(echo $LAST | cut -d' ' -f1)"
BOTTOM="$(echo $LAST | cut -d' ' -f2)"
if [ -z "$(borg diff $BACKUP_DIR::$TOP $BOTTOM)" ]; then
    borg delete $BACKUP_DIR::$(echo $LAST | cut -d' ' -f2)
else
    echo "New backup $(echo $LAST | cut -d' ' -f2)"
backup_patterns.txt
New file
@@ -0,0 +1,3 @@
sh:**/*~
sh:**/.DS_STORE
sh:**/*.7z