diff --git a/hermes_cli/main.py b/hermes_cli/main.py index 03c739d5..b232d5b5 100644 --- a/hermes_cli/main.py +++ b/hermes_cli/main.py @@ -754,12 +754,31 @@ def cmd_update(args): print() print("✓ Update complete!") + + # Auto-restart gateway if it's running as a systemd service + try: + check = subprocess.run( + ["systemctl", "--user", "is-active", "hermes-gateway"], + capture_output=True, text=True, timeout=5, + ) + if check.stdout.strip() == "active": + print() + print("→ Gateway service is running — restarting to pick up changes...") + restart = subprocess.run( + ["systemctl", "--user", "restart", "hermes-gateway"], + capture_output=True, text=True, timeout=15, + ) + if restart.returncode == 0: + print("✓ Gateway restarted.") + else: + print(f"⚠ Gateway restart failed: {restart.stderr.strip()}") + print(" Try manually: hermes gateway restart") + except (FileNotFoundError, subprocess.TimeoutExpired): + pass # No systemd (macOS, WSL1, etc.) — skip silently + print() print("Tip: You can now log in with Nous Portal for inference:") print(" hermes login # Authenticate with Nous Portal") - print() - print("Note: If you have the gateway service running, restart it:") - print(" hermes gateway restart") except subprocess.CalledProcessError as e: print(f"✗ Update failed: {e}")