From 6a3a8321f0d24db1578f2f2d20fcbb2163d1e5ad Mon Sep 17 00:00:00 2001 From: Jerome Charaoui <jerome@riseup.net> Date: Fri, 19 Jan 2018 15:11:50 -0500 Subject: [PATCH] [borg] build/debug prunestr only if prune = yes --- handlers/borg.in | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/handlers/borg.in b/handlers/borg.in index d1c8a78..f98a244 100644 --- a/handlers/borg.in +++ b/handlers/borg.in @@ -151,17 +151,18 @@ fi ### REMOVE OLD BACKUPS ### # borg prune -prunestr="borg prune --keep-hourly $keephourly --keep-daily $keepdaily --keep-weekly $keepweekly --keep-monthly $keepmonthly $execstr_repository" -debug "$prunestr" - -if [ $test = 0 ] && [ "$prune" == "yes" ]; then - output="`su -c "$prunestr" 2>&1`" - if [ $? = 0 ]; then - debug $output - info "Removing old backups succeeded." - else - warning $output - warning "Failed removing old backups." +if [ "$prune" == "yes" ]; then + prunestr="borg prune --keep-hourly $keephourly --keep-daily $keepdaily --keep-weekly $keepweekly --keep-monthly $keepmonthly $execstr_repository" + debug "$prunestr" + if [ $test = 0 ]; then + output="`su -c "$prunestr" 2>&1`" + if [ $? = 0 ]; then + debug $output + info "Removing old backups succeeded." + else + warning $output + warning "Failed removing old backups." + fi fi fi -- GitLab