Bye Bye Moore

PoCソルジャーな零細事業主が作業メモを残すブログ

Ubuntuが稼働しているPCのサスペンドや休止を無効化する

SeeedのOdyssey Blueをシステム制御用のPCとして使っています。
機能は兎も角、一定時間でサスペンドする設定で何か画面を繋いで急場しのぎはしたものの、どうも文化的でない。
調べた結果、systemctlがそこらを決定している模様……。

実際のところ

systemctlのsleep、suspend、hibernate……あとhybrid-sleepとかいうハイカラそうな機能をmaskします。

$ sudo systemctl mask sleep.target suspend.target hibernate.target hybrid-sleep.target

参考もとの通り、機能が停止しているか確認します。

$ sudo systemctl status sleep.target suspend.target hibernate.target hybrid-sleep.target
● sleep.target
     Loaded: masked (Reason: Unit sleep.target is masked.)
     Active: inactive (dead)

● suspend.target
     Loaded: masked (Reason: Unit suspend.target is masked.)
     Active: inactive (dead)

● hibernate.target
     Loaded: masked (Reason: Unit hibernate.target is masked.)
     Active: inactive (dead)

● hybrid-sleep.target
     Loaded: masked (Reason: Unit hybrid-sleep.target is masked.)
     Active: inactive (dead)