Ubuntu – How to shutdown the computer when hitting the Power button

acpishutdownxfce

I have a Xubuntu Lucid 10.04 computer plugged in to my TV. I use the command line to administrate it.

Right now when I hit the power button it just opens a Logout screen.

How can I set it up so that I can shut it down by hitting the power button?
I know it has something to do with acpi or acpid.

I want answers to be command-line only as I do not have any keyboard or mouse connected to that computer.


Edit:

Isn't there a way to modify the default behavior of the xfce4 power manager when pushing the power button?

Also instead of using the GUI to do so, can I do it by creating/modifying a configuration file?

jbowtie had an interesting answer but I cannot find the xfce4-power-manager.xml file. If someone knows where to find that file or how to create it, I would be interested.

Best Answer

When you hit the power button, the script /etc/acpi/powerbtn.sh is called. So one option is to modify this script to just call the shutdown script, bypassing the power management daemon. This works across all distributions and environments that I know of.

Since you're using Xubuntu, you can however just change the setting 'power-switch-action' in xfce4-power-manager.xml to the shutdown action - the default value is the ask action.