Fix log filename collisions: use local time instead of UTC

Log filenames used UTC time while cron runs in local time, causing
different runs to generate the same filename (e.g. 04:00 local and
06:00 local both mapped to 04:00 UTC). Use local time for log
filenames to ensure each run gets a unique file.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
shuki
2026-03-07 06:11:02 +02:00
parent 810a7c5629
commit c9ffe0cb5f

View File

@@ -20,7 +20,7 @@ init_logging() {
local log_dir="${LOG_DIR:-/var/log/gniza}"
mkdir -p "$log_dir" || die "Cannot create log directory: $log_dir"
LOG_FILE="$log_dir/gniza-$(date -u +%Y%m%d-%H%M%S).log"
LOG_FILE="$log_dir/gniza-$(date +%Y%m%d-%H%M%S).log"
touch "$LOG_FILE" || die "Cannot write to log file: $LOG_FILE"
# Clean old logs