bundles/backup-client: only log to logfile when not running in debug mode
This commit is contained in:
parent
5a86e657ff
commit
2fddd57ed8
1 changed files with 7 additions and 4 deletions
|
@ -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
|
||||||
|
if [[ -z "$DEBUG" ]]
|
||||||
|
then
|
||||||
logfile="$logdir/backup--$(date '+%F--%H-%M-%S')--$$.log.gz"
|
logfile="$logdir/backup--$(date '+%F--%H-%M-%S')--$$.log.gz"
|
||||||
echo "All log output will go to $logfile" | logger -it backup-client
|
echo "All log output will go to $logfile" | logger -it backup-client
|
||||||
exec > >(gzip >"$logfile")
|
exec > >(gzip >"$logfile")
|
||||||
exec 2>&1
|
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)
|
||||||
|
|
Loading…
Reference in a new issue