From 02b6d883aa9fcb03ed8e9067f41e3704c26621d4 Mon Sep 17 00:00:00 2001 From: Ben <ben@wainei.net> Date: Fri, 12 Jan 2018 17:51:58 -0500 Subject: [PATCH] [borg] fixed pruning in test mode, don't actually run anything --- handlers/borg.in | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/handlers/borg.in b/handlers/borg.in index 4b7e716..2ce3502 100644 --- a/handlers/borg.in +++ b/handlers/borg.in @@ -97,8 +97,8 @@ set +o noglob # include client-part and server-part execstr="${execstr} ${excludes} $execstr_repository::$execstr_archive ${includes}" - debug "$execstr" + if [ $test = 0 ]; then output=`nice -n $nicelevel su -c "$execstr" 2>&1` if [ $? = 0 ]; then @@ -114,15 +114,17 @@ fi # borg prune prunestr="borg prune --keep-daily $keepdaily --keep-weekly $keepweekly --keep-monthly $keepmonthly $execstr_repository" - debug "$prunestr" -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 [ $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 return 0 -- GitLab