Shutdown Pressing Power Button
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.
- 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.
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