diff --git a/backup-android.sh b/backup-android.sh index 85f942d..8428367 100755 --- a/backup-android.sh +++ b/backup-android.sh @@ -26,6 +26,10 @@ function time_diff { printf '%ds\n' $S } +function prune() { + test -z "$PRUNE_COMMAND" && return + ./run_remote.sh cd "$DESTINATION_LOCATION" "&&" $PRUNE_COMMAND "$BORG_REPO" +} function backup() { # First, we need to rsync our changes to the host echo "Running rsync..." @@ -57,6 +61,9 @@ backup RESULT=$? DURATION="$(time_diff "$(date +%s)" "$START_TIME" )" +# Prune +prune + echo "Completed $(date +%F-%T)" echo "Duration: $DURATION" diff --git a/env.dist b/env.dist index 62b8f72..957a519 100644 --- a/env.dist +++ b/env.dist @@ -5,3 +5,4 @@ REMOTE_HOST="user@example.com" DESTINATION_LOCATION="~/tmp/borg/$HOSTNAME/" BORG_COMMAND="borg create --verbose --progress --stats --one-file-system --exclude-caches --compression auto,lzma" BORG_REPO="runner2:borg/$HOSTNAME" +# PRUNE_COMMAND="borg prune -v --list --keep-daily 7 --keep-weekly 4 --keep-monthly 2"