Difference between revisions of "Shutdown Pressing Power Button"

From ArchWiki
Jump to: navigation, search
(redirect to Power Management as suggested)
(26 intermediate revisions by 10 users not shown)
Line 1: Line 1:
[[Category:Power management (English)]]
+
#REDIRECT [[Power Management]]
{{i18n|Shutdown Pressing Power Button}}
+
{{Note| Some machines only file the power button acpi event after some seconds, eg Thinkpads - 3 seconds.}}
+
 
+
First of all, make sure that "button" module is loaded (check the output of lsmod). If it's not, load it manually
+
# modprobe button
+
or add it to your [[Rc.conf#Hardware|/etc/rc.conf MODULES array]] so that it's automatically loaded at boot time.
+
 
+
# Install acpid.
+
# If there is no hal in the DAEMONS array in rc.conf, add acpid to the DAEMONS array.
+
# Edit /etc/acpi/handler.sh (as root):
+
 
+
...
+
case "$1" in
+
    button/power)
+
        #echo "PowerButton pressed!">/dev/tty5
+
        case "$2" in
+
            PWRF)  logger "PowerButton pressed: $2"
+
    /sbin/poweroff;;
+
            *)      logger "ACPI action undefined: $2" ;;
+
        esac
+
        ;;
+
...
+
 
+
To be able to test it, make sure the acpid daemon is started. To test it without actually shutting down, comment out the {{codeline|poweroff}} line and check your user/messages logs.
+
 
+
If you do not have hal, start the acpid daemon yourself:
+
# /etc/rc.d/acpid start
+
 
+
Otherwise restart hal, it will take care of acpid:
+
# /etc/rc.d/hal restart
+

Revision as of 08:17, 27 July 2013

Redirect to: