如何进行RHEL7.2最小化安装后的电源管理配置

本篇文章给大家分享的是有关如何进行RHEL7.2最小化安装后的电源管理配置,小编觉得挺实用的,因此分享给大家学习,希望大家阅读完这篇文章后可以有所收获,话不多说,跟着小编一起来看看吧。

描述

公司发了个测试笔记本。 以最小化安装RHEL7.2后,发现合上笔记本盖后,系统会自动睡眠,网卡会关闭。 在网上找了一通,总算找到了解决办法。

操作环境

RHEL7.2 x64

详细步骤操作

在/etc/systemd/logind.conf 此配置文件中定义了基本电源管理项。下面是默认配置

[root@localhost ~]# cat /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

#HandleLidSwitchDocked=ignore

#PowerKeyIgnoreInhibited=no

#SuspendKeyIgnoreInhibited=no

#HibernateKeyIgnoreInhibited=no

#LidSwitchIgnoreInhibited=yes

#IdleAction=ignore

#IdleActionSec=30min

#RuntimeDirectorySize=10%

#RemoveIPC=yes

#This is default for OL7.2

RemoveIPC=no

通过man 命令可以看这个文件的说明

[root@localhost ~]# man logind.conf

#...下面是部分说明

       HandlePowerKey=, HandleSuspendKey=, HandleHibernateKey=, HandleLidSwitch=, HandleLidSwitchDocked=

           Controls whether logind shall handle the system power and sleep keys and the lid switch to trigger actions such as

           system power-off or suspend. Can be one of "ignore", "poweroff", "reboot", "halt", "kexec", "suspend", "hibernate",

           "hybrid-sleep", and "lock". If "ignore", logind will never handle these keys. If "lock", all running sessions will be

           screen-locked; otherwise, the specified action will be taken in the respective event. Only input devices with the

           "power-switch" udev tag will be watched for key/lid switch events.  HandlePowerKey= defaults to "poweroff".

           HandleSuspendKey= and HandleLidSwitch= default to "suspend".  HandleLidSwitchDocked= defaults to "ignore".

           HandleHibernateKey= defaults to "hibernate". If the system is inserted in a docking station, or if more than one

           display is connected, the action specified by HandleLidSwitchDocked= occurs; otherwise the HandleLidSwitch= action

           occurs.

HandlePowerKey:按下电源键后的动作

HandleSleepKey:按下挂起键后的动作

HandleHibernateKey: 按下休眠键后的动作

HandleLidSwitch:合上笔记本盖后待机

gnore(什么都不做)

poweroff(关机)

reboot(重新启动)

halt(关机,和poweroff有什么区别,需要手动断开电源?)

kexec ( 杀死执行进程 )

suspend(待机挂起)

hibernate(休眠)

如果不想让系统在合上笔记本的时候待机,编辑/etc/systemd/logind.conf 文件,将HandleLidSwitch注释去掉,并将值修改为ignore 。然后root用户执行命令systemctl restart systemd-logind,使更改生效。

以上就是如何进行RHEL7.2最小化安装后的电源管理配置,小编相信有部分知识点可能是我们日常工作会见到或用到的。希望你能通过这篇文章学到更多知识。更多详情敬请关注行业资讯频道。