diff --git a/scripts/restic/backup.sh b/scripts/restic/backup.sh index a0fd25e..55ca6fa 100755 --- a/scripts/restic/backup.sh +++ b/scripts/restic/backup.sh @@ -25,7 +25,7 @@ printf ">> starting restic backup to repository '"$RESTIC_REPOSITORY"'...\n" for directory in ${RESTIC_DIRECTORIES[@]}; do seconds="$SECONDS" printf "\n> backing up '"$directory"'...\n" - restic backup --verbose --no-scan --retry-lock 3h "$directory" + sudo --preserve-env -u "$RESTIC_USER" restic backup --verbose --no-scan --retry-lock 3h "$directory" printf "> backup of '"$directory"' finished after "$(( $SECONDS - $seconds ))" seconds!\n" done diff --git a/scripts/restic/prune.sh b/scripts/restic/prune.sh index 0c666ac..aff6fd7 100755 --- a/scripts/restic/prune.sh +++ b/scripts/restic/prune.sh @@ -15,7 +15,7 @@ printf ">> pruning repository '"$RESTIC_REPOSITORY"'...\n\n" # execute "pre" action if defined [[ -n "$RESTIC_PRUNE_PRE" ]] && eval "$RESTIC_PRUNE_PRE" -restic forget --keep-daily 7 --keep-weekly 1 --keep-monthly 1 --prune --retry-lock 3h +sudo --preserve-env -u "$RESTIC_USER" restic forget --keep-daily 7 --keep-weekly 1 --keep-monthly 1 --prune --retry-lock 3h # execute "post" action if defined [[ -n "$RESTIC_PRUNE_POST" ]] && eval "$RESTIC_PRUNE_POST" diff --git a/scripts/restic/restic.sh b/scripts/restic/restic.sh index 19166fc..72be3cc 100755 --- a/scripts/restic/restic.sh +++ b/scripts/restic/restic.sh @@ -20,6 +20,7 @@ script="$(dirname $(realpath "$0"))/$action.sh" home="$(dirname $(realpath "$0"))" # setup restic +export RESTIC_USER="$(whoami)" export RESTIC_REPOSITORY="rest:http://192.168.100.101:8000" export RESTIC_PASSWORD="\$Velvet90" export RESTIC_COMPRESSION="max"