The method of closing the cover of notebook and sleeping standby through CentOS 7.0 power management


Make full use of the computing resources, and install the old hp6325 notebook into a Linux CentOS 7.0 download machine for remote control. One problem is that CentOS 7.0 power management will shut the notebook up by default and then sleep and stand by. FTP and SSH can’t access it, unless it wakes up manually or remotely through the network. This means that laptops can never be closed…
Is there any way to cancel the sleep standby after closing the notebook through power management like windows?
Linux is such a powerful operating system, of course.
Power management that can be defined through / etc / SYSTEMd
Actions include:

Handlepowerkey: action after pressing the power key
Handlesleepkey: action after pressing the suspend key
Handlehibernatekey: action after pressing sleep key
Handlelidswitch: standby after closing the notebook cover

The values of these actions can be

Gnore (do nothing)
Reboot (reboot)
Halt (what's the difference between power off and power off? Do you need to disconnect the power supply manually?)
Suspend (standby suspend)
Hibernate (hibernate)

By default, when I close the laptop screen, the system will stand by.
What if I don’t want the system to stand by when I close my laptop?

Open / etc / SYSTEMd with VI editor/ logind.conf

Remove the comment symbol before handlelidswitch and change its value from suspend to ignore.



Then systemctl restart SYSTEMd logind for the changes to take effect. Close the lid of the notebook again, it will not stand by.
If you want to enter standby mode again, you can execute systemctl suspend.