When running under systemd, the gateway could enter restart loops in two scenarios: 1. The previous gateway process hasn't fully exited when systemd starts a new one, causing 'Gateway already running (PID ...)' → exit 1 → restart → same error → infinite loop. 2. The interactive CLI exits immediately in non-TTY mode, and systemd keeps restarting it. Changes: - Add --replace flag to 'hermes gateway run' that gracefully kills any existing gateway instance (SIGTERM → wait 10s → SIGKILL) before starting, preventing the PID-lock deadlock. - Update the generated systemd unit template to use --replace by default, add ExecStop for clean shutdown, set KillMode=mixed and TimeoutStopSec=15 for proper process management. - Existing behavior (without --replace) is unchanged: still prints the error message and exits, now also mentioning the --replace option. Fixes #576
71 KiB
71 KiB