templates/docker-compose/borgmatic/ - avoid losing STDERR lines

use stdbuf to change the buffereing mode to be linewise
This commit is contained in:
Nick Stokoe
2025-05-27 18:18:06 +01:00
parent 4fecd838ae
commit 5ca9ecfe2a
2 changed files with 8 additions and 1 deletions

View File

@@ -1,4 +1,11 @@
FROM b3vis/borgmatic:latest-msmtp FROM b3vis/borgmatic:latest-msmtp
# Install stdbuf, used by backup.sh
RUN \
echo "* Installing Runtime Packages" \
&& apk upgrade --no-cache \
&& echo "* Installing Runtime Packages" \
&& apk add -U --no-cache \
coreutils
COPY --chmod=755 backup.sh /backup.sh COPY --chmod=755 backup.sh /backup.sh

View File

@@ -31,7 +31,7 @@ indent() {
log() { log() {
# Adapted from https://stackoverflow.com/a/31151808 # Adapted from https://stackoverflow.com/a/31151808
{ {
"$@" 2>&1 1>&3 3>&- | indent " ! " stdbuf -oL -eL "$@" 2>&1 1>&3 3>&- | indent " ! "
} 3>&1 1>&2 | indent " | " | tee -a "$LOGFILE" } 3>&1 1>&2 | indent " | " | tee -a "$LOGFILE"
} }