From 0d724c536d38d4bdb1e13ec5b069071de064bac8 Mon Sep 17 00:00:00 2001 From: vlado Date: Mon, 18 May 2026 06:33:50 +0200 Subject: [PATCH] reporter --- Medicus/DBrestore/restore.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Medicus/DBrestore/restore.py b/Medicus/DBrestore/restore.py index d2a54cc..45abcf1 100644 --- a/Medicus/DBrestore/restore.py +++ b/Medicus/DBrestore/restore.py @@ -128,10 +128,16 @@ try: except Exception as e: print(f"Varovani: nepodarilo se zkontrolovat pripojeni ({e})\n") + # Zastav Firebird, smaz DB, spust znovu TARGET_DB.parent.mkdir(parents=True, exist_ok=True) + print("Stavim sluzbu FirebirdServerCGM...") + subprocess.run(["net", "stop", "FirebirdServerCGM"], capture_output=True) if TARGET_DB.exists(): TARGET_DB.unlink() print(f"Smazana stara DB: {TARGET_DB}") + print("Spoustim sluzbu FirebirdServerCGM...") + subprocess.run(["net", "start", "FirebirdServerCGM"], capture_output=True) + time.sleep(3) cmd = [str(GBAK), "-rep", "-v", str(extracted), str(TARGET_DB), "-user", USER, "-pas", PASSWORD] print(f"\nSpoustim: {' '.join(cmd)}\n") @@ -149,8 +155,6 @@ try: success = True print(f"\nObnova dokoncena. Cas: {minutes}:{seconds:02d} (min:sec)") LAST_RESTORED.write_text(latest_zip.name, encoding="utf-8") - latest_zip.unlink() - print(f"Smazan ZIP: {latest_zip.name}") extracted.unlink() print(f"Smazan FBK: {extracted.name}") # Test DB - pocet registrovanych pacientu