feat: disable auto-suspend in setup.sh for server environments
- Mask sleep.target, suspend.target, hibernate.target, hybrid-sleep.target - Configure systemd-logind to: - Ignore lid switch events - Ignore power key presses - Disable idle action - Set runtime directory size - Restart systemd-logind to apply changes Servers running Officer shouldn't go to sleep when idle. This prevents unexpected suspends during setup or normal operation.
This commit is contained in:
@@ -258,6 +258,31 @@ else
|
|||||||
esac
|
esac
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# ─── 4b. Disable auto-suspend (server doesn't need to sleep) ──────────────────
|
||||||
|
echo ""
|
||||||
|
echo "── Auto-suspend (disable for server) ──"
|
||||||
|
|
||||||
|
# Disable system suspend/hibernate
|
||||||
|
if systemctl is-enabled sleep.target 2>/dev/null | grep -q "enabled\|masked"; then
|
||||||
|
sudo systemctl mask sleep.target suspend.target hibernate.target hybrid-sleep.target 2>/dev/null
|
||||||
|
ok "Masked sleep/suspend targets"
|
||||||
|
else
|
||||||
|
skip "sleep targets already masked"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Configure logind to ignore idle
|
||||||
|
sudo tee /etc/systemd/logind.conf > /dev/null << 'LOGIND_EOF'
|
||||||
|
[Login]
|
||||||
|
HandleLidSwitch=ignore
|
||||||
|
HandleLidSwitchExternalPower=ignore
|
||||||
|
HandlePowerKey=ignore
|
||||||
|
IdleAction=none
|
||||||
|
RuntimeDirectorySize=10%
|
||||||
|
LOGIND_EOF
|
||||||
|
|
||||||
|
sudo systemctl restart systemd-logind
|
||||||
|
ok "Configured logind to disable auto-suspend"
|
||||||
|
|
||||||
# ─── 5. Node.js 22 ────────────────────────────────────────────────────────────
|
# ─── 5. Node.js 22 ────────────────────────────────────────────────────────────
|
||||||
echo ""
|
echo ""
|
||||||
echo "── Node.js 22 (system-wide) ──"
|
echo "── Node.js 22 (system-wide) ──"
|
||||||
|
|||||||
Reference in New Issue
Block a user