fix sudo usage

This commit is contained in:
Daniel Sommer 2024-08-30 10:21:15 +02:00
parent 6be503b700
commit 3af34b0064
3 changed files with 3 additions and 2 deletions

View file

@ -25,7 +25,7 @@ printf ">> starting restic backup to repository '"$RESTIC_REPOSITORY"'...\n"
for directory in ${RESTIC_DIRECTORIES[@]}; do for directory in ${RESTIC_DIRECTORIES[@]}; do
seconds="$SECONDS" seconds="$SECONDS"
printf "\n> backing up '"$directory"'...\n" 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" printf "> backup of '"$directory"' finished after "$(( $SECONDS - $seconds ))" seconds!\n"
done done

View file

@ -15,7 +15,7 @@ printf ">> pruning repository '"$RESTIC_REPOSITORY"'...\n\n"
# execute "pre" action if defined # execute "pre" action if defined
[[ -n "$RESTIC_PRUNE_PRE" ]] && eval "$RESTIC_PRUNE_PRE" [[ -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 # execute "post" action if defined
[[ -n "$RESTIC_PRUNE_POST" ]] && eval "$RESTIC_PRUNE_POST" [[ -n "$RESTIC_PRUNE_POST" ]] && eval "$RESTIC_PRUNE_POST"

View file

@ -20,6 +20,7 @@ script="$(dirname $(realpath "$0"))/$action.sh"
home="$(dirname $(realpath "$0"))" home="$(dirname $(realpath "$0"))"
# setup restic # setup restic
export RESTIC_USER="$(whoami)"
export RESTIC_REPOSITORY="rest:http://192.168.100.101:8000" export RESTIC_REPOSITORY="rest:http://192.168.100.101:8000"
export RESTIC_PASSWORD="\$Velvet90" export RESTIC_PASSWORD="\$Velvet90"
export RESTIC_COMPRESSION="max" export RESTIC_COMPRESSION="max"