Fix dashboard service/tracker status flickering

Show service status based on actual container state instead of systemd
oneshot status. Remove systemctl calls from restart to prevent tracker
flip-flopping.
This commit is contained in:
SamNet-dev
2026-01-31 12:52:03 -06:00
parent fcca48bd31
commit 28c137342e

View File

@@ -2642,8 +2642,13 @@ show_status() {
# Check for systemd # Check for systemd
if command -v systemctl &>/dev/null && systemctl is-enabled conduit.service 2>/dev/null | grep -q "enabled"; then if command -v systemctl &>/dev/null && systemctl is-enabled conduit.service 2>/dev/null | grep -q "enabled"; then
echo -e " Auto-start: ${GREEN}Enabled (systemd)${NC}${EL}" echo -e " Auto-start: ${GREEN}Enabled (systemd)${NC}${EL}"
local svc_status=$(systemctl is-active conduit.service 2>/dev/null) # Show service based on actual container state (systemd oneshot status is unreliable)
echo -e " Service: ${svc_status:-unknown}${EL}" local svc_containers=$(docker ps --filter "name=^conduit" --format '{{.Names}}' 2>/dev/null | wc -l)
if [ "${svc_containers:-0}" -gt 0 ] 2>/dev/null; then
echo -e " Service: ${GREEN}active${NC}${EL}"
else
echo -e " Service: ${YELLOW}inactive${NC}${EL}"
fi
# Check for OpenRC # Check for OpenRC
elif command -v rc-status &>/dev/null && rc-status -a 2>/dev/null | grep -q "conduit"; then elif command -v rc-status &>/dev/null && rc-status -a 2>/dev/null | grep -q "conduit"; then
echo -e " Auto-start: ${GREEN}Enabled (OpenRC)${NC}${EL}" echo -e " Auto-start: ${GREEN}Enabled (OpenRC)${NC}${EL}"
@@ -2883,10 +2888,6 @@ restart_conduit() {
fi fi
# Regenerate tracker script and ensure service is running # Regenerate tracker script and ensure service is running
setup_tracker_service 2>/dev/null || true setup_tracker_service 2>/dev/null || true
# Sync systemd service state so dashboard shows "active"
if command -v systemctl &>/dev/null && systemctl is-enabled conduit.service &>/dev/null; then
systemctl restart conduit.service 2>/dev/null || true
fi
} }
change_settings() { change_settings() {