From 5adb22754f33eb2a89d54bbcb4f5bceee820cb17 Mon Sep 17 00:00:00 2001 From: igor04091968 Date: Mon, 27 Apr 2026 21:40:17 +0300 Subject: [PATCH] fix(linux-logger): parse who -u pts fields and avoid duplicate start with systemd --- scripts/install_aw_console_ssh_logger.sh | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/scripts/install_aw_console_ssh_logger.sh b/scripts/install_aw_console_ssh_logger.sh index 85d9bb8..a811b47 100755 --- a/scripts/install_aw_console_ssh_logger.sh +++ b/scripts/install_aw_console_ssh_logger.sh @@ -212,7 +212,7 @@ class Collector: if len(parts) < 2: continue user = parts[0] - tty = parts[1] + tty = next((p for p in parts[1:] if p.startswith("pts/") or p.startswith("tty")), "") if not tty.startswith("pts/"): continue sessions[tty] = { @@ -355,12 +355,18 @@ ${AUTO_BLOCK_END} EOF fi +started_with_systemd="0" if command -v systemctl >/dev/null 2>&1; then systemctl --user daemon-reload >/dev/null 2>&1 || true systemctl --user enable --now aw-console-ssh-logger.service >/dev/null 2>&1 || true + if systemctl --user is-active --quiet aw-console-ssh-logger.service >/dev/null 2>&1; then + started_with_systemd="1" + fi fi -"${BIN_DIR}/aw-console-ssh-logger-start" +if [ "${started_with_systemd}" != "1" ]; then + "${BIN_DIR}/aw-console-ssh-logger-start" +fi echo "Installed AW console/ssh logger" echo "Server target: ${SERVER_HOST}:${SERVER_PORT}"