make_mirror.sh: instead of prefixing with the current time, print the timedelta since script start

This commit is contained in:
Johannes 'josch' Schauer 2019-03-01 12:44:31 +01:00
parent b7f7f4e581
commit aa319c64b2
Signed by: josch
GPG key ID: F2CBA5C78FBD83E1

View file

@ -285,7 +285,7 @@ systemctl restart mini-httpd
handler () {
while IFS= read -r line || [ -n "$line" ]; do
printf "%s %s: %s\n" "$(date +%T.%3N)" "$1" "$line"
printf "%s %s: %s\n" "$(date -u -d "0 $(date +%s.%3N) seconds - $2 seconds" +"%T.%3N")" "$1" "$line"
done
}
@ -296,11 +296,12 @@ handler () {
mount -o loop,umask=000 cover_db.img cover_db
fi
now=$(date +%s.%3N)
ret=0
{ { { { {
sh -x ./test.sh 2>&1 1>&4 3>&- 4>&-; echo $? >&2;
} | handler E >&3;
} 4>&1 | handler O >&3;
} | handler E "$now" >&3;
} 4>&1 | handler O "$now" >&3;
} 2>&1;
} | { read xs; exit $xs; };
} 3>&1 || ret=$?