新安装的服务器操作系统可能会自动休眠, 那么如何禁止ubuntu 20.04自动休眠

$ systemctl status sleep.target

● sleep.target – Sleep

Loaded: loaded (/lib/systemd/system/sleep.target; static; vendor preset: enabled)

Active: inactive (dead)

Docs: man:systemd.special(7)

Feb 24 13:18:08 xps systemd[1]: Reached target Sleep.

Feb 26 13:29:31 xps systemd[1]: Stopped target Sleep.

Feb 26 13:29:57 xps systemd[1]: Reached target Sleep.

Feb 26 13:30:19 xps systemd[1]: Stopped target Sleep.

> # sudo systemctl mask sleep.target suspend.target hibernate.target hybrid-sleep.target

再次查看状态, 变成masked了

> # systemctl status sleep.target

● sleep.target

Loaded: masked (Reason: Unit sleep.target is masked.)

Active: inactive (dead)