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,使更改生效。

资料参考引用

http://www.jb51.net/os/RedHat/506934.html

 

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/11780477/viewspace-2132872/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/11780477/viewspace-2132872/

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值