From 0b961f5f2079348de19b0d0d72fd09b29e153416 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=B6rg=20Sachse?= <joerg.sachse@slub-dresden.de>
Date: Fri, 13 Jan 2023 10:04:22 +0100
Subject: [PATCH] fix: make error summary more resilient by skipping
 unrecognized files and triggering the Timer at 01:00am when Rosetta
 logrotation has finished

---
 files/error-summary.sh           | 1 +
 templates/error-summary.timer.j2 | 4 +++-
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/files/error-summary.sh b/files/error-summary.sh
index 110583d..25dc98d 100755
--- a/files/error-summary.sh
+++ b/files/error-summary.sh
@@ -151,6 +151,7 @@ get_last_n_days(){
 			GREP_CMD="grep"
 		else
 			>&2 echo "ERROR: unknown filetype, cannot find error strings from file '${LOGFILE}'."
+			continue
 		fi
 		${GREP_CMD} -oP "${FILTER_STRING}" "${LOGFILE}"
 	done | \
diff --git a/templates/error-summary.timer.j2 b/templates/error-summary.timer.j2
index a3c9e59..96672ee 100644
--- a/templates/error-summary.timer.j2
+++ b/templates/error-summary.timer.j2
@@ -3,7 +3,9 @@ Description=timer daily Rosetta error summary
 
 [Timer]
 #Run every day (daily ==> *-*-* 00:00:00)
-OnCalendar=daily
+#OnCalendar=daily
+#Run every day at 01:00 o'clock, after Rosetta's logrotation/compression has happened
+OnCalendar=*-*-* 01:00:00
 #When activated, it triggers the service immediately if it missed the last start time, for example due to the system being powered off
 Persistent=true
 #Unit to activate when the timer elapses. (default is set to the same name as the timer unit, except for the suffix)
-- 
GitLab