This commit is contained in:
2025-11-04 09:36:26 +01:00
parent 4131557887
commit d091312d0f
18 changed files with 9243 additions and 2 deletions

View File

@@ -0,0 +1,41 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Step 2: Restart Firebird service (FirebirdServerCGM)
Forces all connections to close before database restore.
"""
import subprocess
import time
SERVICE_NAME = "FirebirdServerCGM"
def run_cmd(cmd):
"""Run a command and return (success, output)."""
try:
result = subprocess.run(cmd, capture_output=True, text=True, shell=True)
return result.returncode == 0, result.stdout.strip() + result.stderr.strip()
except Exception as e:
return False, str(e)
print(f"🔧 Restarting service: {SERVICE_NAME}")
# --- Stop service
ok, out = run_cmd(f'net stop "{SERVICE_NAME}"')
if ok:
print(f"🛑 Service {SERVICE_NAME} stopped.")
else:
print(f"⚠️ Failed to stop service (it may already be stopped):\n{out}")
# --- Small delay
time.sleep(5)
# --- Start service again
ok, out = run_cmd(f'net start "{SERVICE_NAME}"')
if ok:
print(f"▶️ Service {SERVICE_NAME} started.")
else:
print(f"❌ Failed to start service:\n{out}")
print("✅ Firebird restart sequence complete.")