From a38b69140325b9da74521e6a972192ec10e5df54 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Austen=E2=80=9D?= Date: Sun, 15 Sep 2019 10:55:36 -0400 Subject: [PATCH] Add commands --- backup-android.sh | 7 +++++++ env.dist | 1 + 2 files changed, 8 insertions(+) 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"