Difference between revisions of "Shutdown Pressing Power Button"

From ArchWiki
Jump to: navigation, search
m
Line 1: Line 1:
 
[[Category:Power management (English)]]
 
[[Category:Power management (English)]]
 
{{i18n|Shutdown Pressing Power Button}}
 
{{i18n|Shutdown Pressing Power Button}}
{{Note| Some machines only file the power button acpi event after the power button is held down for some seconds, eg Thinkpads - 3 seconds.}}
+
{{Note| Some machines only fire the power button acpi event after the power button is held down for 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
 
First of all, make sure that "button" module is loaded (check the output of lsmod). If it's not, load it manually

Revision as of 22:59, 6 November 2011

This template has only maintenance purposes. For linking to local translations please use interlanguage links, see Help:i18n#Interlanguage links.


Local languages: Català – Dansk – English – Español – Esperanto – Hrvatski – Indonesia – Italiano – Lietuviškai – Magyar – Nederlands – Norsk Bokmål – Polski – Português – Slovenský – Česky – Ελληνικά – Български – Русский – Српски – Українська – עברית – العربية – ไทย – 日本語 – 正體中文 – 简体中文 – 한국어


External languages (all articles in these languages should be moved to the external wiki): Deutsch – Français – Română – Suomi – Svenska – Tiếng Việt – Türkçe – فارسی

Note: Some machines only fire the power button acpi event after the power button is held down for 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 /etc/rc.conf MODULES array so that it's automatically loaded at boot time.

  1. Install acpid.
  2. If there is no hal in the DAEMONS array in rc.conf, add acpid to the DAEMONS array.
  3. 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 Template:Codeline 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