Created
October 14, 2020 10:19
-
-
Save agp8x/3e20c9d57253ecd3b81ea85da84d9741 to your computer and use it in GitHub Desktop.
local backup with restic
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/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