From 092cbd55e43bab2f819f66ac6ced5b418470ed06 Mon Sep 17 00:00:00 2001 From: MHSanaei Date: Sun, 27 Sep 2026 18:19:48 +0200 Subject: [PATCH] fix(x-ui.sh): read the service state without scanning the journal check_status ran `systemctl status x-ui` and grepped its Active line. That command also prints the unit's latest journal lines, so it reads the journal every time the menu is drawn, before most actions, and on hosts with months of logs the script stalled for a long time before showing its options. `systemctl show --property=SubState` returns the same "running" state from the unit alone. The prefix is stripped by hand rather than with --value so it still works on systemd older than 230. No test harness covers x-ui.sh. To demonstrate on a host with a large journal: time systemctl status x-ui >/dev/null time systemctl show --property=SubState x-ui Refs #6629 --- x-ui.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/x-ui.sh b/x-ui.sh index 7213ff3e2..ee49e3665 100644 --- a/x-ui.sh +++ b/x-ui.sh @@ -897,7 +897,8 @@ check_status() { if [[ ! -f ${xui_service}/x-ui.service ]]; then return 2 fi - temp=$(systemctl status x-ui | grep Active | awk '{print $3}' | cut -d "(" -f2 | cut -d ")" -f1) + temp=$(systemctl show --property=SubState x-ui) + temp=${temp#SubState=} if [[ "${temp}" == "running" ]]; then return 0 else