fix: improve systemd service setup check for active status in setup script
This commit is contained in:
@ -197,9 +197,9 @@ else
|
|||||||
echo "Pre-built frontend detected. Skipping frontend build."
|
echo "Pre-built frontend detected. Skipping frontend build."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# 4.3 Setup system service (only if systemd is running)
|
# 4.3 Setup system service (only if systemd is active)
|
||||||
# Note: in containerized environments (no systemd PID 1), systemctl will fail.
|
# Note: in non-systemd contexts (containers, chroots), systemctl will fail.
|
||||||
if [ "$(cat /proc/1/comm 2>/dev/null)" = "systemd" ] && command -v systemctl > /dev/null 2>&1; then
|
if command -v systemctl > /dev/null 2>&1 && systemctl is-system-running --quiet 2>/dev/null; then
|
||||||
cat <<EOF > /etc/systemd/system/mpvj-backend.service
|
cat <<EOF > /etc/systemd/system/mpvj-backend.service
|
||||||
[Unit]
|
[Unit]
|
||||||
Description=MPVJ Backend
|
Description=MPVJ Backend
|
||||||
@ -216,7 +216,7 @@ EOF
|
|||||||
systemctl daemon-reload
|
systemctl daemon-reload
|
||||||
systemctl enable mpvj-backend.service
|
systemctl enable mpvj-backend.service
|
||||||
else
|
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"
|
echo "You can run the backend manually: node $REAL_HOME/mpvj/backend/index.js"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user