LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Hardware (http://www.linuxquestions.org/questions/linux-hardware-18/)
-   -   Power Button for Shutdown (http://www.linuxquestions.org/questions/linux-hardware-18/power-button-for-shutdown-138029/)

gokul 01-24-2004 12:53 AM

Power Button for Shutdown
 
Details:

I use Mandrake 9.2 with a kernel I compiled with ACPI and APM support.
The kernel is 2.6.1. Patches for supermount has also been applied.

Question:

How to make use of the powerbutton on the cabinet to powerdown my linux system.

adz 01-24-2004 02:48 AM

You don't I think. Just type halt or reboot as root into any command prompt.

gokul 01-24-2004 03:32 AM

Well I know the other ways to shutdown the conputer. I need to know about this. If it is possible in say, windoze then it "must" be possible in our Linux. A nifty feature for desktop users. Would not mind hibernating my system either. I am waiting for the SWAP "file" implementation of hibernation in Linux 2.6+.

Thanks for the interest.

hazza 01-24-2004 04:19 AM

If you have acpi enabled at boot (acpi=on kernel arguemnt) then all you have to do is get the acpi and acpid services running:

# chkconfig acpid on
# chkconfig acpi on
# service acpid start
# service acpi start

If you don't see any output when you start the acpid service then chances are acpid wasn't enabled at boot. Provided you have the suspend-scripts package then /etc/acpid/events/power should look something like this:

event=button/power (PWR.|PBTN)
action=/sbin/poweroff

So when you press the power button /sbin/poweroff is run. I haven't tried this with kernel 2.6.x but I have managed to shutdown my box by pressing the power button.

gokul 01-24-2004 01:40 PM

U were right hazza. I just had to enable the services and voila!
Thanks!:-)
Can u trap the reboot button and do a proper reboot with a high priority interrupt or something? It might help when the computer hangs hopelessly(although a lot less for other people. I fiddle around a lot!)


All times are GMT -5. The time now is 03:48 PM.