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."
|
||||
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 <<EOF > /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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user