From df4b4656deb1ef31ae426b749d04187e25180a8b Mon Sep 17 00:00:00 2001
From: "Hahn Axel (hahn)" <axel.hahn@iml.unibe.ch>
Date: Fri, 18 Mar 2022 15:16:50 +0100
Subject: [PATCH] client backup: show dumped databases

---
 check_clientbackup | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)

diff --git a/check_clientbackup b/check_clientbackup
index 2ba7480..8ef7d9f 100755
--- a/check_clientbackup
+++ b/check_clientbackup
@@ -10,6 +10,7 @@
 # 2020-04-04  v1.3  <axel.hahn@iml.unibe.ch> set status unknown if never executed
 # 2022-02-17  v1.4  <axel.hahn@iml.unibe.ch> no tmpfile; show more output to see backed up dirs
 # 2022-03-07  v1.5  <axel.hahn@iml.unibe.ch> update scan for results in transfer
+# 2022-03-18  v1.6  <axel.hahn@iml.unibe.ch> show dumped databases
 # ======================================================================
 
 . $( dirname $0 )/inc_pluginfunctions
@@ -38,15 +39,21 @@ fi
 
 ph.status
 echo "$result" | grep -F "MONITORINFO:" | cut -f 2- -d ':'
-
-echo
-echo "--- localdump:"
-echo "$result" | grep -v "STATUS" | cut -f 2- -d ":" | grep "\ backup\ \["
 echo
+
+# show lines __DB__ of backed up databases and skip al database types
+# that do not have a line "__DB__[type] backup"
+for dbtype in $( echo "$result" | grep -o '__DB__[a-z]*' | sort -u )
+do
+        echo "$result" | grep "$dbtype\ backup" >/dev/null \
+                && echo --- local dumps "${dbtype//__DB__/}" \
+                && echo "$result" | grep "$dbtype" | grep -v ".log" \
+                && echo
+done
+
 echo "--- transfer:"
 echo "$result" | grep "__[A-Z][A-Z]*__\ "
 
-
 ph.exit
 
 # ----------------------------------------------------------------------
-- 
GitLab