# 防止挂起、休眠状态,禁用以下 systemd 目标。
| sudo systemctl mask sleep.target suspend.target hibernate.target hybrid-sleep.target |
| |
| hybrid-sleep.target |
| Created symlink /etc/systemd/system/sleep.target → /dev/null. |
| Created symlink /etc/systemd/system/suspend.target → /dev/null. |
| Created symlink /etc/systemd/system/hibernate.target → /dev/null. |
| Created symlink /etc/systemd/system/hybrid-sleep.target → /dev/null. |
| |
| sudo systemctl status sleep.target suspend.target hibernate.target hybrid-sleep.target |
启用挂起和休眠
| sudo systemctl unmask sleep.target suspend.target hibernate.target hybrid-sleep.target |
| |
| Removed /etc/systemd/system/sleep.target. |
| Removed /etc/systemd/system/suspend.target. |
| Removed /etc/systemd/system/hibernate.target. |
| Removed /etc/systemd/system/hybrid-sleep.target. |
防止在合上盖子时进入挂起状态
| sudo vim /etc/systemd/logind.conf |
[Login]
HandleLidSwitch=ignore
HandleLidSwitchDocked=ignore