Skip to content

Commit

Permalink
scaffold restic backup scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
MaxWolf-01 committed Feb 8, 2024
1 parent 73ab7dd commit 121ae45
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 0 deletions.
18 changes: 18 additions & 0 deletions bin/pull_repo_list_to_backup
Original file line number Diff line number Diff line change
@@ -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
16 changes: 16 additions & 0 deletions bin/restic_backup_firecuda
Original file line number Diff line number Diff line change
@@ -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
16 changes: 16 additions & 0 deletions bin/restic_backup_local
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 121ae45

Please sign in to comment.