diff --git a/bin/pull_repo_list_to_backup b/bin/pull_repo_list_to_backup new file mode 100755 index 0000000..a20d12f --- /dev/null +++ b/bin/pull_repo_list_to_backup @@ -0,0 +1,18 @@ +#!/bin/bash +# Pull or clone multiple git repositories to backup folder + +TARGET_DIR="$HOME/backup" +REPO_FILE="$HOME/.dotfiles/secrets/backup_repos_list.txt" + +readarray -t REPO_LIST < "$REPO_FILE" +for REPO_URL in "${REPO_LIST[@]}"; do + REPO_NAME=$(basename -s .git "$REPO_URL") + REPO_DIR="$TARGET_DIR/$REPO_NAME" + if [ -d "$REPO_DIR" ]; then + echo "Updating repository: $REPO_NAME" + git -C "$REPO_DIR" pull + else + echo "Cloning repository: $REPO_NAME" + git clone "$REPO_URL" "$REPO_DIR" + fi +done diff --git a/bin/restic_backup_firecuda b/bin/restic_backup_firecuda new file mode 100755 index 0000000..182d7a5 --- /dev/null +++ b/bin/restic_backup_firecuda @@ -0,0 +1,16 @@ +#!/bin/bash +# Seagate backup +# ensure the repo is set up via: +# restic init --repo /media/max/Seagate/restic/ + +. ~/.dotfiles/secrets/passwords/restic + +export RESTIC_REPOSITORY=/media/max/Seagate/restic +export RESTIC_PASSWORD=$PWD_SEAGATE_FIRECUDA + +# TODO stop syncthing + +bash ~/.dotfiles/bin/pull_repo_list_to_backup +restic backup --option compression=max --files-from ~/.dotfiles/secrets/backup_dirs_list.txt + +# TODO start syncthing diff --git a/bin/restic_backup_local b/bin/restic_backup_local new file mode 100755 index 0000000..7f62a4a --- /dev/null +++ b/bin/restic_backup_local @@ -0,0 +1,16 @@ +#!/bin/bash +# Local backup +# ensure the repo is set up via: +# restic init --repo /home/max/repos/tools/restic + +. ~/.dotfiles/secrets/passwords/restic + +export RESTIC_REPOSITORY=/home/max/repos/tools/restic +export RESTIC_PASSWORD=$PWD_LOCAL + +# TODO stop syncthing + +bash ~/.dotfiles/bin/pull_repo_list_to_backup +restic backup --option compression=max --files-from ~/.dotfiles/secrets/backup_dirs_list.txt + +# TODO start syncthing