From 777c217e3a6956bfbf9fa3e582251b0ef2c75bb8 Mon Sep 17 00:00:00 2001
From: "Hahn Axel (hahn)" <axel.hahn@unibe.ch>
Date: Wed, 2 Oct 2024 14:19:40 +0200
Subject: [PATCH] localdump: reset $rc before calling db plugin

---
 localdump.sh | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/localdump.sh b/localdump.sh
index 2c4f134..c1a6df5 100755
--- a/localdump.sh
+++ b/localdump.sh
@@ -18,6 +18,7 @@
 # 2022-11-04  ah     rename hooks
 # 2024-03-14  ah     v2.0: use profiles for local and remote databases
 # 2024-03-18  ah     fix for db detection from file and cli restore
+# 2024-10-02  ah     reset $rc before calling db plugin
 # ======================================================================
 
 # --- variables:
@@ -486,6 +487,8 @@ EOH
                 _j_runHooks "200-before-db-service"
   
                 h3 "BACKUP [${PROFILENAME}] -> ${SERVICENAME}"
+                rcbak=$rc
+                rc=0
                 . $BACKUP_SCRIPT $mode
   
                 test $rc -gt 0 && j_notify "db ${SERVICENAME}" "$BACKUP_SCRIPT $mode was finished with rc=$rc" $rc
@@ -497,6 +500,8 @@ EOH
                 # ----- post jobs: cleanup
                 cleanup_backup_target
                 show_info_backup_target
+
+                rc=$rc+$rcbak
     
             else
   
-- 
GitLab