zoukankan      html  css  js  c++  java
  • linux系统(Ubuntu)之合上笔记本盖但不断网

    配置场景:ubuntu电脑作为服务器,开机后把盖合上,省的屏幕亮。刚开始一盖上电脑盖电脑就断开网络,导致其他客户端电脑无法访问服务器。修改配置方法如下:

    编辑下列文件:/etc/systemd/logind.conf

    #HandlePowerKey按下电源键后的行为,默认power off

    #HandleSleepKey 按下挂起键后的行为,默认suspend

    #HandleHibernateKey按下休眠键后的行为,默认hibernate

    #HandleLidSwitch合上笔记本盖后的行为,默认suspend(改为lock;即合盖不休眠)在原文件中,还要去掉前面的#

    运行:systemctl restart systemd-logind 就会生效。

    --------------------------------------------------------------------------------------------------

    附上运行演示:

    [root@liangxiaozhan]# 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=ignore (在这里把#号去掉,然后把默认suspend改成ignore)

    #HandleLidSwitchDocked=ignore

    #PowerKeyIgnoreInhibited=no

    #SuspendKeyIgnoreInhibited=no

    #HibernateKeyIgnoreInhibited=no

    #LidSwitchIgnoreInhibited=yes

    #IdleAction=ignore

    #IdleActionSec=30min

    #RuntimeDirectorySize=10%

    #RemoveIPC=no

    #UserTasksMax

    [root@liangxiaozhan]# systemctl restart systemd-logind (运行重启生效或者重启电脑)

  • 相关阅读:
    创建一个简单的图片服务器
    spring-boot系列:初试spring-boot
    java的动态代理机制
    jedis连接池详解(Redis)
    使用logback.xml配置来实现日志文件输出
    redis在mac上的安装
    理解RESTful架构
    分布式应用框架Akka快速入门
    [Java基础]Java通配符
    Mac vim iterm2配色方案
  • 原文地址:https://www.cnblogs.com/Jayson-yang/p/15090450.html
Copyright © 2011-2022 走看看