2012/5/18 Bruce Dubbs <[email protected]>: > Andrew Benton wrote: >> On Fri, 18 May 2012 14:44:00 +0100 >> xinglp <[email protected]> wrote: >> >>> In order to use "power button" to shutdown or suspend my lfs. >>> I enabled the depreciate /proc/acpi/event in kernel, >>> and install acpid to handle the button event. >>> It works well. >>> >>> But is there any clear way to do that, such as by inittab or udev >>> or kernel callout userspace script ( /proc/sys/kernel/poweroff_cmd has >>> somethings ) >>> >>> I've looked into blfs, there's a lot more packages need to be >>> installed to enable this.(I'm not a X user,for now.) >> >> I don't know of any other way of handling the power button event at >> init 3. I used to install acpid, like you, for this reason but I >> stopped as I hardly spend any time at the command prompt nowadays. So >> what I do now is alter /etc/inittab so that it handles ctrl alt del by >> shutting down instead of rebooting: >> >> ca:12345:ctrlaltdel:/sbin/halt >> >> When X is running I have my window manager (Openbox) handle pressing >> the power button (xev says it is XF86PowerOff) by running a script >> which (after it's tidied up a few things) calls /sbin/halt. > > Just a suggestion. You could write a short script to run at C-A-D and ask if > you want to shut down or reboot. I don't know if this would run in a window > manager or not.
I've written a script to handle power button, so my box can suspend to disk(hibernate). On one of my boxes, when I press the power button for one time, the /proc/acpi/event create many event. So when my hibernated box restored, it go hibernate again, and again. Perhaps I need to replace the power button switch. > > -- Bruce > -- > http://linuxfromscratch.org/mailman/listinfo/lfs-support > FAQ: http://www.linuxfromscratch.org/lfs/faq.html > Unsubscribe: See the above information page -- http://linuxfromscratch.org/mailman/listinfo/lfs-support FAQ: http://www.linuxfromscratch.org/lfs/faq.html Unsubscribe: See the above information page
