Улучшить вывод make status: кратко и без логов journal
Одна строка на хост (active/not installed, since, PID, RAM); хост без установки больше не валит весь make.
This commit is contained in:
@@ -71,10 +71,20 @@ check: ## Проверить синтаксис playbook
|
||||
ping: ## Проверить SSH-доступ ко всем VPS
|
||||
$(ANSIBLE_ADHOC) hysteria2_servers -m ping $(ANSIBLE_OPTS)
|
||||
|
||||
status: ## Статус hysteria-server на VPS
|
||||
$(ANSIBLE_ADHOC) hysteria2_servers -m shell \
|
||||
-a "systemctl status hysteria-server --no-pager || systemctl status hysteria2 --no-pager" \
|
||||
-b $(VAULT_ARGS) $(if $(LIMIT),--limit $(LIMIT),)
|
||||
status: ## Краткий статус hysteria-server на VPS
|
||||
@$(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); \
|
||||
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; \
|
||||
echo "$$UNIT: $$STATE | since $$SINCE | PID $$PID | RAM $$MEM"; \
|
||||
[ "$$STATE" = "active" ]' \
|
||||
-b -o $(ANSIBLE_OPTS)
|
||||
|
||||
install: check ## Установить Hysteria2 на VPS (+ URL и QR локально)
|
||||
$(ANSIBLE) playbook.yml --tags install $(ANSIBLE_OPTS)
|
||||
|
||||
Reference in New Issue
Block a user