家居小楠人≈

您现在的位置是:首页 > 慢生活 > 程序人生网站首页慢生活

CentOS7|8 阻止笔记本合盖时休眠

家居小楠人≈ 2020-09-20 41人围观
简介 自己收集的文章,学习之用!!!

查看电源管理设置

/etc/systemd/logind.conf 我没动过,下面都是默认值:(注意它们前面都有#也就是说,都是注释状态。我修改后记得去掉#

[root@asdsad ~]# vim /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
#HandleLidSwitchExternalPower=suspend
#HandleLidSwitchDocked=ignore
#PowerKeyIgnoreInhibited=no
#SuspendKeyIgnoreInhibited=no
#HibernateKeyIgnoreInhibited=no
#LidSwitchIgnoreInhibited=yes
#HoldoffTimeoutSec=30s
#IdleAction=ignore
#IdleActionSec=30min
#RuntimeDirectorySize=10%
#RemoveIPC=no
#InhibitorsMax=8192
#SessionsMax=8192

关键部分是这几个 Handle开头的

#HandlePowerKey=poweroff #  按下电源键后如何
#HandleSuspendKey=suspend # 待机挂起后如何
#HandleHibernateKey=hibernate # 按下休眠键后如何
#HandleLidSwitch=suspend # 合上笔记本盖后如何
#HandleLidSwitchDocked=ignore # 合上笔记本盖后外接显示器如何

可选的参数值

参数说明
ignore忽略,啥也不干
power off关电源
reboot重启
halt挂起。停止所有的 CPU 功能,但是仍然保持通电。
kexec不懂
suspend待机
hibernate进入休眠(内存数据存入硬盘,关闭电源)
hybrid-sleep混合睡眠=睡眠+休眠,主要是为台式机设计的,内存和CPU还是活的。
lock锁屏,机器继续跑(相当于Win+L)


修改指定的值 重启服务


systemctl restart systemd-logind.service










文章评论