Fix bug when no exclude file set.

Fix bug with return value when running a restic backup in cron mode.
This commit is contained in:
Rob Pearce 2020-10-09 11:27:16 +11:00
parent 504405c6ff
commit b57bbdac21
1 changed files with 5 additions and 3 deletions

View File

@ -700,7 +700,7 @@ for f in $REPOSTOBACKUP; do
fi fi
export RESTIC_EXCLUDEFILE=`getrepoexcludefile "$f"` export RESTIC_EXCLUDEFILE=`getrepoexcludefile "$f"`
if [[ ! -z $RESTIC_PASSWORD_FILE ]]; then if [[ ! -z $RESTIC_EXCLUDEFILE ]]; then
OTHEROPTS="$OTHEROPTS --exclude-file=${RESTIC_EXCLUDEFILE}" OTHEROPTS="$OTHEROPTS --exclude-file=${RESTIC_EXCLUDEFILE}"
fi fi
OTHEROPTS="$OTHEROPTS $RESTICOPTS" OTHEROPTS="$OTHEROPTS $RESTICOPTS"
@ -790,11 +790,13 @@ for f in $REPOSTOBACKUP; do
elif [[ $mode == "restic" ]]; then elif [[ $mode == "restic" ]]; then
if [[ $CMD == "go" ]]; then if [[ $CMD == "go" ]]; then
if [[ $CRONMODE -eq 1 ]]; 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 else
[[ $VERBOSE -eq 1 ]] && log "debug: running: [${RESTIC} backup $AUTHOPTS $CONNECTIONSOPTS $SPEEDOPTS $OTHEROPTS $DATAPATH"
${RESTIC} backup $AUTHOPTS $CONNECTIONSOPTS $SPEEDOPTS $OTHEROPTS $DATAPATH 2>&1 >> ${LOG} ${RESTIC} backup $AUTHOPTS $CONNECTIONSOPTS $SPEEDOPTS $OTHEROPTS $DATAPATH 2>&1 >> ${LOG}
fi
rv=$? rv=$?
fi
elif [[ $CMD == "ls" ]]; then elif [[ $CMD == "ls" ]]; then
${RESTIC} snapshots $AUTHOPTS $CONNECTIONSOPTS 2>&1 >> ${LOG} ${RESTIC} snapshots $AUTHOPTS $CONNECTIONSOPTS 2>&1 >> ${LOG}
rv=$? rv=$?