Ubuntu 18.04 ノートPCを閉じてもサスペンドさせないためには

JenkinsをノートPCに引っ越し

最近、JenkinsをミドルタワーPCからノートPCへ引っ越ししました。ミドルタワーPCは、AMD Phenom X4で、androidのAVDが動かないことが難点でした。

ノートPCも古いです。2011年製のHP dv7-6000。CPUはIntel Core-i7 2670QMなので、androidのAVDが動きます。

もろもろ引っ越して、ミドルタワーPCの電源をオフにすると、UPSの消費電力が140Wから70Wに減りました。一ヶ月の消費電力は、70W × 24時間 × 30日 = 50.4kW

東京電力の第3段階の30.57円 / kW で計算すると、50.4kW × 30.57円 = 1540円。

AWSのt2.microより高かったんだね

さて、Jenkinsを常に動かしておきたいので、ノートPCを閉じてもサスペンドしないようにします。

/etc/systemd/logind.conf を編集

/etc/systemd/logind.conf を編集します。

$ sudo vim /etc/systemd/logind.confCode language: Bash (bash)

編集前

#
# Entries in this file show the compile time defaults.
# You can change settings by editing this file.
# Defaults can be restored by simply deleting this file.
#
# See logind.conf(5) for details.

[Login]
#NAutoVTs=6
#ReserveVT=6
#KillUserProcesses=no
#KillOnlyUsers=
#KillExcludeUsers=root
#InhibitDelayMaxSec=5
#HandlePowerKey=poweroff
#HandleSuspendKey=suspend
#HandleHibernateKey=hibernate
#HandleLidSwitch=suspend
#HandleLidSwitchDocked=ignore
#PowerKeyIgnoreInhibited=no
#SuspendKeyIgnoreInhibited=no
#HibernateKeyIgnoreInhibited=no
#LidSwitchIgnoreInhibited=yes
#HoldoffTimeoutSec=30s
#IdleAction=ignore
#IdleActionSec=30min
#RuntimeDirectorySize=10%
#RemoveIPC=yes
#InhibitorsMax=8192
#SessionsMax=8192
#UserTasksMax=33%Code language: PHP (php)

18行目を編集します。コメントをはずして、HandleLidSwitchの値をsuspendからignoreへ変更します。

#HandleLidSwitch=suspend
↓
HandleLidSwitch=ignoreCode language: PHP (php)

編集後

#
# Entries in this file show the compile time defaults.
# You can change settings by editing this file.
# Defaults can be restored by simply deleting this file.
#
# See logind.conf(5) for details.

[Login]
#NAutoVTs=6
#ReserveVT=6
#KillUserProcesses=no
#KillOnlyUsers=
#KillExcludeUsers=root
#InhibitDelayMaxSec=5
#HandlePowerKey=poweroff
#HandleSuspendKey=suspend
#HandleHibernateKey=hibernate
HandleLidSwitch=ignore
#HandleLidSwitchDocked=ignore
#PowerKeyIgnoreInhibited=no
#SuspendKeyIgnoreInhibited=no
#HibernateKeyIgnoreInhibited=no
#LidSwitchIgnoreInhibited=yes
#HoldoffTimeoutSec=30s
#IdleAction=ignore
#IdleActionSec=30min
#RuntimeDirectorySize=10%
#RemoveIPC=yes
#InhibitorsMax=8192
#SessionsMax=8192
#UserTasksMax=33%Code language: PHP (php)

systemd-logindを再起動します。

$ sudo  systemctl restart systemd-logindCode language: Bash (bash)

参考URL

Access Denied
Linux(systemd)を入れたノートPCを、閉じてもサスペンドさせないようにする - Qiita
完全に自分用備忘録です。毎度毎度忘れるんですよねえ。早速本題へ入ります。使うのはみんな大好きCentOS7.1設定変更するファイルは /etc/systemd/logind.conf になり…
404 NOT FOUND | 兎飼道 RACING TEAM
兎飼道RACING TEAMのサイトです
タイトルとURLをコピーしました