禁止Debian 12进入休眠
参考链接
查看状态
root@leo:~# systemctl status sleep.target
○ sleep.target - Sleep
Loaded: loaded (/lib/systemd/system/sleep.target; static)
Active: inactive (dead)
Docs: man:systemd.special(7)
Aug 24 21:29:24 leo systemd[1]: Reached target sleep.target - Sleep.
Aug 24 21:34:59 leo systemd[1]: Stopped target sleep.target - Sleep.
设置禁止休眠
root@leo:~# systemctl mask sleep.target suspend.target hibernate.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.
不会再出现自动休眠状态
root@leo:~# systemctl status sleep.target
○ sleep.target
Loaded: masked (Reason: Unit sleep.target is masked.)
Active: inactive (dead)