add backup scritps

This commit is contained in:
Alexander Navarro 2023-10-07 15:32:50 -03:00
parent aa9d186a5a
commit 6c0870e817
3 changed files with 30 additions and 2 deletions

28
scripts/cloud_sync Executable file
View file

@ -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