From 26310153c0b53a59365917e4ebde63f776c5c68e Mon Sep 17 00:00:00 2001 From: ygd58 Date: Fri, 3 Apr 2026 18:25:51 +0200 Subject: [PATCH] fix(status): detect gateway process when running as PID 1 in Docker/Kubernetes --- hermes_cli/status.py | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/hermes_cli/status.py b/hermes_cli/status.py index aeb159a556..1b52d0e0c5 100644 --- a/hermes_cli/status.py +++ b/hermes_cli/status.py @@ -295,8 +295,23 @@ def show_status(args): is_active = result.stdout.strip() == "active" except subprocess.TimeoutExpired: is_active = False + + # Fallback: check if hermes gateway is running as a process (Docker/Kubernetes/PID 1) + manager = "systemd (user)" + if not is_active: + try: + pgrep = subprocess.run( + ["pgrep", "-f", "hermes.*gateway"], + capture_output=True, text=True, timeout=5 + ) + if pgrep.returncode == 0: + is_active = True + manager = "direct process (non-systemd)" + except Exception: + pass + print(f" Status: {check_mark(is_active)} {'running' if is_active else 'stopped'}") - print(" Manager: systemd (user)") + print(f" Manager: {manager}") elif sys.platform == 'darwin': from hermes_cli.gateway import get_launchd_label