diff --git a/.metadata b/.metadata index ef2f238..620bc31 100644 Binary files a/.metadata and b/.metadata differ diff --git a/tools/startup.d/110-startlogs.sh b/tools/startup.d/110-startlogs.sh index 1a696ad..320e51d 100755 --- a/tools/startup.d/110-startlogs.sh +++ b/tools/startup.d/110-startlogs.sh @@ -6,6 +6,8 @@ # Author: Kovács Zoltán # License: GNU/GPL v3+ (https://www.gnu.org/licenses/gpl-3.0.en.html) # +# 2025-06-01 v0.4 +# fix: better continuation of existing log file (even if empty). # 2025-03-29 v0.3 # mod: no longer repeats existing log lines. # 2025-02-26 v0.2 @@ -103,10 +105,11 @@ else [[ -n "$logline" ]] \ && timestamp="$(echo "$logline" | "$CUT" -d' ' -f1 2>/dev/null)" \ || timestamp="invalid" - # Checks the validity. + # If the log does not contain a valid last timestamp, we write log lines + # created since the last time the container was started. [[ $("$DATE" -d "$timestamp" >/dev/null 2>&1; echo $?) -eq 0 ]] \ && since="$timestamp" \ - || since="1970-01-01T00:00Z" + || since="$("$DOCKER" inspect -f '{{ .State.StartedAt }}' $container)" # Only logs the new lines (actually repeats the last one - TODO!). "$DOCKER" logs -t --since "$since" -f $container >> "$BASE_DIR/$LOGDIR/$service.log" 2>&1 & fi