From 7c950a368980e5e136066eb0b2527f4cb8ef00a5 Mon Sep 17 00:00:00 2001
From: "Hahn Axel (hahn)" <axel.hahn@unibe.ch>
Date: Wed, 12 Apr 2023 12:20:22 +0200
Subject: [PATCH] add some notifications

---
 backup.sh   | 4 ++++
 transfer.sh | 2 ++
 2 files changed, 6 insertions(+)

diff --git a/backup.sh b/backup.sh
index 3142cc3..ac5c8b1 100755
--- a/backup.sh
+++ b/backup.sh
@@ -177,6 +177,7 @@ EOFbackupinfo
 
   if [ $bStart -eq 1 ]; then
 
+    j_notify "Start" "Starting a backup run..."
     _j_runHooks "100-before-backup"
 
     sleep 3
@@ -194,6 +195,7 @@ EOFbackupinfo
 
     "${DIR_SELF}"/localdump.sh ALL | tee -a "$JOB_LOGFILE"
     rcBackup=$?
+    test $rcBackup -gt 0 && j_notify "db dumps" "rc=$rcBackup" $rcBackup
 
     echo "INFO: $(date) - local backups were finished" | tee -a "$JOB_LOGFILE"
     echo
@@ -212,6 +214,7 @@ EOFbackupinfo
       # "${DIR_SELF}"/transfer.sh $JOBDEF_TYPE "$JOBDEF_AUTO" 2>&1 | tee -a "$JOB_LOGFILE"
       "${DIR_SELF}"/transfer.sh $JOBDEF_TYPE "$JOBDEF_AUTO" 2>&1
       rcTransfer=$?
+      test $rcTransfer -gt 0 && j_notify "Transfer Dirs" "rc=$rcTransfer" $rcTransfer
 
     else
       echo                                                         | tee -a "$JOB_LOGFILE"
@@ -260,6 +263,7 @@ EOFbackupinfo
 # --------------------------------------------------------------------------------
 
 
+  j_notify "Done" "Backup was finished. rc=$rcBackup" $rcBackup
   exit $rcBackup
 
 
diff --git a/transfer.sh b/transfer.sh
index 8443e42..1d4f46d 100755
--- a/transfer.sh
+++ b/transfer.sh
@@ -451,6 +451,7 @@ function setAction(){
       touch "${lastprunefile}"
     else
       rc+=1
+      j_notify "Prune" "Pruning old data in the repostitory failed." 1
     fi
     ls -l "${lastprunefile}"
     echo
@@ -466,6 +467,7 @@ function setAction(){
       touch "${lastverifyfile}"
     else
       rc+=1
+      j_notify "Verify" "Verify of repository data failed." 1
     fi
     ls -l "${lastverifyfile}"
     echo
-- 
GitLab