Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I use Debian and I want my power button to shutdown the PC. Currently it sleeps, when I press it.

Is there any command for it to make it shutdown?

share|improve this question

1 Answer 1

up vote 1 down vote accepted

/etc/acpi/events/powerbtn-acpi-support leads to /etc/acpi/powerbtn-acpi-support.sh, which in turns calls for /etc/acpi/powerbtn.sh. I've not tested, but you may try to create this file and fill it with something like

#!/bin/bash

/sbin/shutdown -h now "Power button pressed"

Note that in principle it won't exit your session cleanly, though, so depending on the desktop environment / window manager you use you may want to improve it to handle things more cleanly (e.g. adding gnome-session-save --kill before if you use gnome).

The best way to go would probably be to google search for other users /etc/acpi/powerbtn.sh scripts.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.