centos 7 关闭笔记本合盖挂起功能

centos 7 关闭笔记本合盖挂起功能
家里有一台dell的老笔记本,安装了centos7系统使用。
默认系统配置把笔记本电脑屏合上后会造成挂起,网络断开。笔记本不能合盖,放置占位,也会造成灰尘进入键盘等总之不是很方便。
systemd可以处理ACPI事件,这个默认配置可以通过修改systemd-logind.service的行为修改。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
[root@server ~]# vi /etc/systemd/logind.conf
# This file is part of systemd.
#
# systemd is free software; you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation; either version 2.1 of the License, or
# (at your option) any later version.
#
# 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
HandleLidSwitch=ignore #这个合盖操作修改为ignore,合盖时不做任务操作。
#HandleLidSwitchDocked=ignore
#PowerKeyIgnoreInhibited=no
#SuspendKeyIgnoreInhibited=no
#HibernateKeyIgnoreInhibited=no
#LidSwitchIgnoreInhibited=yes
#IdleAction=ignore
#IdleActionSec=30min
#RuntimeDirectorySize=10%
#RemoveIPC=no
#UserTasksMax=

行为可以是 ignore、poweroff、reboot、halt、suspend、hibernate、hybrid-sleep、lock 或 kexec。

1
2
3
[root@server ~]# systemctl list-units |grep logind
systemd-logind.service loaded active running Login Service
[root@server ~]# systemctl restart systemd-logind

重启服务后合上笔记本,网络不受影响。

1
2
3
[root@server ~]# ping 192.168.3.1
PING 192.168.3.1 (192.168.3.1) 56(84) bytes of data.
64 bytes from 192.168.3.1: icmp_seq=1 ttl=64 time=0.557 ms
坚持原创技术分享,您的支持将鼓励我继续创作!