borg-backup: save PIPESTATUS before referencing
It's not obvious, but the if statements can change the PIPESTATUS meaning we're not matching what we think we're matching. Save the pipestatus of the backup commands so we exit the backup script with the right code. Change-Id: I83c7db45d3622067eb05107e26fbdc7a8aeecf63
This commit is contained in:
parent
accfb8b0fd
commit
8c9ba67296
@ -43,12 +43,13 @@ do
|
||||
bash $f | ${BORG_CREATE} --stdin-name ${stream_name} \
|
||||
::"{hostname}-${stream_name}-{now}" -
|
||||
|
||||
if [[ ${PIPESTATUS[0]} -ne 0 ]]; then
|
||||
_status=( "${PIPESTATUS[@]}" )
|
||||
if [[ ${_status[0]} -ne 0 ]]; then
|
||||
info "Streaming script ${f} failed!"
|
||||
stream_exit=${PIPESTATUS[0]}
|
||||
elif [[ ${PIPESTATUS[1]} -ne 1 ]]; then
|
||||
stream_exit=${_status[0]}
|
||||
elif [[ ${_status[1]} -ne 1 ]]; then
|
||||
info "Borg failed!"
|
||||
stream_exit=${PIPESTATUS[1]}
|
||||
stream_exit=${_status[1]}
|
||||
else
|
||||
stream_exit=0
|
||||
fi
|
||||
|
Loading…
Reference in New Issue
Block a user