#!/usr/bin/env bash # # BorgBackup # if [ ! -d ~/UTCLOUD/ ]; then red "$HOME/UTCLOUD not attached. Backup not started." exit 1 fi if [ ! -d ~/archive/ ]; then yellow "$HOME/archive/ folder doesn't exist. Downloading latest version from ~/UTCLOUD/archive/ into ~/archive/." rsync --verbose --progress --stats --update --recursive ~/UTCLOUD/archive/ ~/archive fi if [ ! -d ~/borgbackup/ ]; then yellow "$HOME/borgbackup/ repository doesn't exist. Downloading latest version from ~/UTCLOUD/borg/borgbackup/ into ~/borgbackup/." # The initial borg repo was created with: # $ borg init --append-only --encryption=keyfile ~/borgbackup # See also: https://borgbackup.readthedocs.io/en/stable/usage/notes.html#append-only-mode rsync --verbose --progress --stats --update --recursive ~/UTCLOUD/borg/borgbackup/ ~/borgbackup fi BACKUP_TAG="${1-default}" yellow "Creating new borg archive entry" borg create \ --verbose \ --stats \ --progress \ --compression lzma,6 \ ~/borgbackup::"{hostname}-{now}-${BACKUP_TAG}" \ ~/ownCloud/ \ ~/Nextcloud/ \ ~/mbsync/ \ ~/archive/ # add folders to be backed up here green "Done" yellow "Syncing ~/archive to ~/UTCLOUD/archive" rsync --verbose --progress --stats --update --recursive ~/archive/ ~/UTCLOUD/archive/ green "Done" yellow "Syncing ~/borgbackup to ~/UTCLOUD/borg/borgbackup/" rsync --verbose --progress --stats --update --recursive ~/borgbackup/ ~/UTCLOUD/borg/borgbackup/ green "Done" yellow "Syncing ~/borgbackup to $R:borgbackup/" rsync --verbose --progress --stats --update --recursive ~/borgbackup/ "$R:borgbackup/" green "Done" # # mr # yellow "Backing up git repos" pushd ~/ || exit 1 mr -s master mr -s status mr -s -j16 update mr -s hd mr -s -j4 rsyncnet popd || exit 1 yellow "Syncing annex" pushd ~/annex/ || exit 1 git annex sync popd || exit 1 green "Done"