Added the ability to use an includes file with restic

release/full-rewrite
capntack 6 months ago
parent 40b839a5b9
commit e1fecf58ea

@ -18,6 +18,9 @@ export AWS_SECRET_ACCESS_KEY='SECRET-KEY'
# readonly AWS_UPLOAD='2440'
export RESTIC_PASSWORD='PASSWORD'
readonly RESTIC_SOURCE='/path/to/dir/to/backup'
## If you want to backup multiple paths, comment out the above and set the below to 'yes'
## And then add each path to a separate line in the resticIncludes file
readonly RESTIC_SOURCE_FROM_FILE='no'
## RESTIC_CALENDAR_RETENTION must be set to 'yes' for these
## Remove readonly if you want different retention policies

@ -86,6 +86,9 @@ readonly LOG_RETENTION='30'
# export RESTIC_REPOSITORY='/path/to/repo'
# export RESTIC_PASSWORD='PASSWORD'
# readonly RESTIC_SOURCE='/home'
## If you want to backup multiple paths, leave the above commented and set the below to 'yes'
## And then add each path to a separate line in the resticIncludes file
RESTIC_SOURCE_FROM_FILE='no'
## RESTIC_CALENDAR_RETENTION must be set to 'yes' for these
## Remove readonly if LAN_AND_AWS_RESTIC is set to 'yes' and you want different retention policies

@ -1,6 +1,6 @@
#!/bin/bash
if [ $AWS_RESTIC_BACKUP = 'no' ]; then
if [ $AWS_RESTIC_BACKUP = 'no' ] && [ $RESTIC_SOURCE_FROM_FILE = 'no' ]; then
restic backup --verbose \
--tag "${RESTIC_TAG_01}" --tag "${RESTIC_TAG_02}" \
--exclude-caches \
@ -8,7 +8,7 @@ if [ $AWS_RESTIC_BACKUP = 'no' ]; then
"${RESTIC_SOURCE}"
fi
if [ $AWS_RESTIC_BACKUP = 'yes' ]; then
if [ $AWS_RESTIC_BACKUP = 'yes' ] && [ $RESTIC_SOURCE_FROM_FILE = 'no' ]; then
restic backup --verbose \
--tag "${RESTIC_TAG_01}" --tag "${RESTIC_TAG_02}" \
--exclude-caches \
@ -17,3 +17,21 @@ if [ $AWS_RESTIC_BACKUP = 'yes' ]; then
--limit-upload "${AWS_UPLOAD}" \
"${RESTIC_SOURCE}"
fi
if [ $AWS_RESTIC_BACKUP = 'no' ] && [ $RESTIC_SOURCE_FROM_FILE = 'yes' ]; then
restic backup --verbose \
--files-from "${SCRIPT_DIR}"/resticIncludes \
--tag "${RESTIC_TAG_01}" --tag "${RESTIC_TAG_02}" \
--exclude-caches \
--exclude-file="${RESTIC_EXCLUDES}"
fi
if [ $AWS_RESTIC_BACKUP = 'yes' ] && [ $RESTIC_SOURCE_FROM_FILE = 'yes' ]; then
restic backup --verbose \
--files-from "${SCRIPT_DIR}"/resticIncludes \
--tag "${RESTIC_TAG_01}" --tag "${RESTIC_TAG_02}" \
--exclude-caches \
--exclude-file="${RESTIC_EXCLUDES}" \
-o s3.connections="${AWS_CONNECTIONS}" \
--limit-upload "${AWS_UPLOAD}"
fi
Loading…
Cancel
Save