Prevent poweroff on Debian when the physical power button is pressed

To change the actions that the server takes when it receives an ACPI event indicating the power button, edit the: /etc/acpi/powerbtn.sh script.

This will not prevent holding the button to force power off, however.

While we're at it, the line in /etc/inittab:

ca:12345:ctrlaltdel:/sbin/shutdown -t1 -a -r now

Controls the action taken upon pressing C-A-D.


Although you can catch a power button press through ACPI, you can't prevent your girlfriend from pressing and holding the button (to force power down), or from pulling the plug on your server.

My best suggestion is to talk to your girlfriend. Communication is key ;)


Old topic, but can be useful to update

In Debian Stretch (and possibly after Wheezy) power manager is managed by systemd config files. So, for instance, to change the behavior of PowerButton press from 'power off' to 'suspend', edit the file /etc/systemd/logind.conf and change the follow line from

#HandlePowerKey=poweroff

to

HandlePowerKey=suspend

and restart the service with

systemctl restart systemd-logind.service

A good ref is the ArchLinux link posted by @allen

Tags:

Linux

Debian

Acpi