fix: корректный make status при inactive и без -o
systemctl is-active с rc≠0 больше не дублирует inactive; убран deprecated флаг -o. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user