Skip to content

Instantly share code, notes, and snippets.

@agp8x
Created October 14, 2020 10:19
Show Gist options
  • Save agp8x/3e20c9d57253ecd3b81ea85da84d9741 to your computer and use it in GitHub Desktop.
Save agp8x/3e20c9d57253ecd3b81ea85da84d9741 to your computer and use it in GitHub Desktop.
local backup with restic
#!/bin/bash
tags=""
while getopts t: opt; do
case $opt in
t) echo $OPTARG;tags="${tags} --tag ${OPTARG}";;
esac
done
while read name path; do
echo "## ${name}";
if [ ! -d "${name}" ]; then
RESTIC_PASSWORD="foobar" restic -r "${name}" init;
fi;
RESTIC_PASSWORD="foobar" restic -r ${name} backup ${tags} ${path} --exclude-if-present '.restic_ignore:# do not backup' --exclude-if-present '.resticignore';
done < restic_local
/data/backups/projA /home/me/git/code /home/me/Dokumente/A
/data/backups/config /home/me/.config /home/me/.bashrc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment