From dc35bec4fba04a9bab1985895da97ffb226880c3 Mon Sep 17 00:00:00 2001 From: Sergey Antropoff Date: Thu, 23 Jul 2026 08:46:17 +0300 Subject: [PATCH] =?UTF-8?q?fix:=20=D0=BA=D0=BE=D1=80=D1=80=D0=B5=D0=BA?= =?UTF-8?q?=D1=82=D0=BD=D1=8B=D0=B9=20make=20status=20=D0=BF=D1=80=D0=B8?= =?UTF-8?q?=20inactive=20=D0=B8=20=D0=B1=D0=B5=D0=B7=20-o?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit systemctl is-active с rc≠0 больше не дублирует inactive; убран deprecated флаг -o. --- Makefile | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index a811db4..128e59e 100644 --- a/Makefile +++ b/Makefile @@ -72,19 +72,21 @@ ping: ## Проверить SSH-доступ ко всем VPS $(ANSIBLE_ADHOC) hysteria2_servers -m ping $(ANSIBLE_OPTS) status: ## Краткий статус hysteria-server на VPS - @$(ANSIBLE_ADHOC) hysteria2_servers -m shell \ + @ANSIBLE_DEPRECATION_WARNINGS=False ANSIBLE_STDOUT_CALLBACK=minimal \ + $(ANSIBLE_ADHOC) hysteria2_servers -m shell \ -a 'UNIT=""; \ if systemctl cat hysteria-server.service >/dev/null 2>&1; then UNIT=hysteria-server; \ elif systemctl cat hysteria2.service >/dev/null 2>&1; then UNIT=hysteria2; fi; \ if [ -z "$$UNIT" ]; then echo "not installed"; exit 0; fi; \ - STATE=$$(systemctl is-active "$$UNIT" 2>/dev/null || echo inactive); \ + STATE=$$(systemctl is-active "$$UNIT" 2>/dev/null || true); \ + [ -n "$$STATE" ] || STATE=inactive; \ SINCE=$$(systemctl show -p ActiveEnterTimestamp --value "$$UNIT" 2>/dev/null); \ PID=$$(systemctl show -p MainPID --value "$$UNIT" 2>/dev/null); \ MEM=$$(systemctl show -p MemoryCurrent --value "$$UNIT" 2>/dev/null); \ - case "$$MEM" in ""|"[not set]"|"0") MEM="-";; *) MEM="$$((MEM/1024/1024))M";; esac; \ + case "$$MEM" in ""|"[not set]"|"0"|"n/a") MEM="-";; *) MEM="$$((MEM/1024/1024))M";; esac; \ echo "$$UNIT: $$STATE | since $$SINCE | PID $$PID | RAM $$MEM"; \ [ "$$STATE" = "active" ]' \ - -b -o $(ANSIBLE_OPTS) + -b $(ANSIBLE_OPTS) install: check ## Установить Hysteria2 на VPS (+ URL и QR локально) $(ANSIBLE) playbook.yml --tags install $(ANSIBLE_OPTS)