From b57bbdac21c1706bced28f019e4b7eeec21c8eef Mon Sep 17 00:00:00 2001 From: Rob Pearce Date: Fri, 9 Oct 2020 11:27:16 +1100 Subject: [PATCH] Fix bug when no exclude file set. Fix bug with return value when running a restic backup in cron mode. --- bare.sh | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/bare.sh b/bare.sh index 8fbe365..925818c 100755 --- a/bare.sh +++ b/bare.sh @@ -700,7 +700,7 @@ for f in $REPOSTOBACKUP; do fi export RESTIC_EXCLUDEFILE=`getrepoexcludefile "$f"` - if [[ ! -z $RESTIC_PASSWORD_FILE ]]; then + if [[ ! -z $RESTIC_EXCLUDEFILE ]]; then OTHEROPTS="$OTHEROPTS --exclude-file=${RESTIC_EXCLUDEFILE}" fi OTHEROPTS="$OTHEROPTS $RESTICOPTS" @@ -790,11 +790,13 @@ for f in $REPOSTOBACKUP; do elif [[ $mode == "restic" ]]; then if [[ $CMD == "go" ]]; then if [[ $CRONMODE -eq 1 ]]; then - ${RESTIC} backup $AUTHOPTS $CONNECTIONSOPTS $SPEEDOPTS $OTHEROPTS $DATAPATH 2>&1 | egrep "^(Added|processed|snapshot)" >> ${LOG} + {RESTIC} backup $AUTHOPTS $CONNECTIONSOPTS $SPEEDOPTS $OTHEROPTS $DATAPATH 2>&1 | egrep "^(Added|processed|snapshot)" >> ${LOG} + rv=${PIPESTATUS[0]} else + [[ $VERBOSE -eq 1 ]] && log "debug: running: [${RESTIC} backup $AUTHOPTS $CONNECTIONSOPTS $SPEEDOPTS $OTHEROPTS $DATAPATH" ${RESTIC} backup $AUTHOPTS $CONNECTIONSOPTS $SPEEDOPTS $OTHEROPTS $DATAPATH 2>&1 >> ${LOG} + rv=$? fi - rv=$? elif [[ $CMD == "ls" ]]; then ${RESTIC} snapshots $AUTHOPTS $CONNECTIONSOPTS 2>&1 >> ${LOG} rv=$?