From 6c0870e81776ad90f9e002ef909b3f3c109ca3fd Mon Sep 17 00:00:00 2001 From: aleidk Date: Sat, 7 Oct 2023 15:32:50 -0300 Subject: [PATCH] add backup scritps --- config/Distro-AstroNvim | 2 +- scripts/backup | 2 +- scripts/cloud_sync | 28 ++++++++++++++++++++++++++++ 3 files changed, 30 insertions(+), 2 deletions(-) create mode 100755 scripts/cloud_sync diff --git a/config/Distro-AstroNvim b/config/Distro-AstroNvim index dad0bec..f10b473 160000 --- a/config/Distro-AstroNvim +++ b/config/Distro-AstroNvim @@ -1 +1 @@ -Subproject commit dad0bec1fef2833561d04ea446a544fbfde92539 +Subproject commit f10b4730176b567e15911b3c1a7c5a31c82c8b8e diff --git a/scripts/backup b/scripts/backup index 24290d7..7a9c037 100755 --- a/scripts/backup +++ b/scripts/backup @@ -7,7 +7,7 @@ source "$DOTS/config/zsh/config/colors.zsh" && define_colors LOCAL_BACKUP_PATH="$HOME/Drives/Backups/auto-backups/" REMOTE_BACKUP_PATH="auto-backups" -RCLONE_CLOUD_NAME="mega" +RCLONE_CLOUD_NAME="GDrive" DATE_FORMAT="+%F" diff --git a/scripts/cloud_sync b/scripts/cloud_sync new file mode 100755 index 0000000..570191e --- /dev/null +++ b/scripts/cloud_sync @@ -0,0 +1,28 @@ +#!/usr/bin/env bash + +RCLONE_CLOUD_NAME='GDrive' + +declare -A SOURCES +# key local, value remote +SOURCES["$HOME/Drives/Stuff/Pictures"]="/01_Personal/01_Pictures" +SOURCES["$HOME/Drives/Stuff/Music"]="/01_Personal/02_Music" +SOURCES["$HOME/Drives/Backups/auto-backups/services/last"]="/80_Backups/Services" + +config="$(rclone config dump 2>/dev/null | jq ".$RCLONE_CLOUD_NAME // empty")" + +if [[ -z "$config" ]]; then + echo -e "${RED}${SHL}No Rclone configuration! skiping sync.${RST}${EHL}\n" + return +fi + +for i in "${!SOURCES[@]}"; do + local=$i + remote=${SOURCES[$i]} + + rclone bisync \ + --copy-links \ + --progress \ + --resync \ + --stats-one-line \ + "$local" "${RCLONE_CLOUD_NAME}:${remote}" +done