bundles/backup-client: only log to logfile when not running in debug mode

This commit is contained in:
Franzi 2024-07-07 10:23:20 +02:00
parent 5a86e657ff
commit 2fddd57ed8
Signed by: kunsi
GPG key ID: 12E3D2136B818350

View file

@ -62,10 +62,13 @@ trap "on_exit" EXIT
# redirect stdout and stderr to logfile # redirect stdout and stderr to logfile
prepare_and_cleanup_logdir prepare_and_cleanup_logdir
logfile="$logdir/backup--$(date '+%F--%H-%M-%S')--$$.log.gz" if [[ -z "$DEBUG" ]]
echo "All log output will go to $logfile" | logger -it backup-client then
exec > >(gzip >"$logfile") logfile="$logdir/backup--$(date '+%F--%H-%M-%S')--$$.log.gz"
exec 2>&1 echo "All log output will go to $logfile" | logger -it backup-client
exec > >(gzip >"$logfile")
exec 2>&1
fi
# this is where the real work starts # this is where the real work starts
ts_begin=$(date +%s) ts_begin=$(date +%s)