From 093319b903fb6e5402d58ecc55aef4c5f1aa82f2 Mon Sep 17 00:00:00 2001 From: Timothy Hofland Date: Sun, 15 Mar 2026 17:32:41 +0100 Subject: [PATCH] fix: improve systemd service setup check for active status in setup script --- scripts/setup.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/setup.sh b/scripts/setup.sh index 8241001..91870c7 100644 --- a/scripts/setup.sh +++ b/scripts/setup.sh @@ -197,9 +197,9 @@ else echo "Pre-built frontend detected. Skipping frontend build." fi -# 4.3 Setup system service (only if systemd is running) -# Note: in containerized environments (no systemd PID 1), systemctl will fail. -if [ "$(cat /proc/1/comm 2>/dev/null)" = "systemd" ] && command -v systemctl > /dev/null 2>&1; then +# 4.3 Setup system service (only if systemd is active) +# Note: in non-systemd contexts (containers, chroots), systemctl will fail. +if command -v systemctl > /dev/null 2>&1 && systemctl is-system-running --quiet 2>/dev/null; then cat < /etc/systemd/system/mpvj-backend.service [Unit] Description=MPVJ Backend @@ -216,7 +216,7 @@ EOF systemctl daemon-reload systemctl enable mpvj-backend.service else - echo "WARNING: systemd not detected (PID 1 is not systemd). Skipping systemd service setup." + echo "WARNING: systemd is not active/accessible. Skipping systemd service setup." echo "You can run the backend manually: node $REAL_HOME/mpvj/backend/index.js" fi