Linux – Configure Linux server hardware buttons for soft reset or power cycle

centoslinux

I have a small modest CentOS server at home. I run it headless because anytime I access it, it's always via SSH.

Anyways, tonight it became unresponsive to the network. I could not connect to it to investigate. In this case, I have to hook up a keyboard and monitor to see the problem. I ended up just rebooting it.

But after this experience, I was wondering if it's possible to configure the hardware buttons on the CPU case to perform a graceful reboot or graceful power cycle in Linux. Even though the server becomes unresponsive once in a blue moon, it would be nice to simply press a button and have it shutdown all services and gracefully reboot.

Anyone know how this could be accomplished?

Best Answer

If your hardware is ACPI compliant, the archlinux wiki outlines a process which may work for you using a package called acpid. I've had success with this method on other distributions.

https://wiki.archlinux.org/index.php/Shutting_system_down_by_pressing_the_power_button