Invoke script by power button

Hendrik Koch superhenne at freenet.de
Fri Jan 20 06:45:40 PST 2006


Hi,

i am looking for a way to invoke a shell script when i press the
power-button.
The script should do some custom tasks and then "shutdown -p now".

I searched around and found a lot of acpi docs, a solution for linux,
with just placing scripts in a certain directory,
but nothing helpful for me+FreeBSD. I don't want any
sleep/standby/suspend stuff, just a clean shutdown.

Right now when i press the power button, the machine just powers off
imediatly.
How can i catch the event of pressing the power button?

thanks,
kind regards,
Hendrik


My system: FreeBSD 6.0-STABLE, HP-ProLiant ML 350, ACPI-enabled.

from dmesg:

acpi0: <COMPAQ D14> on motherboard
acpi0: Power Button (fixed)
acpi_timer0: <32-bit timer at 3.579545MHz> port 0x920-0x923 on acpi0
cpu0: <ACPI CPU> on acpi0
pcib0: <ACPI Host-PCI bridge> on acpi0
pcib1: <ACPI Host-PCI bridge> on acpi0
pcib2: <ACPI Host-PCI bridge> on acpi0
acpi_button0: <Power Button> on acpi0
acpi_tz0: <Thermal Zone> on acpi0


sysctl hw.acpi:

hw.acpi.supported_sleep_state: S1 S4 S5
hw.acpi.power_button_state: S5
hw.acpi.sleep_button_state: S1
hw.acpi.lid_switch_state: NONE
hw.acpi.standby_state: S1
hw.acpi.suspend_state: S3
hw.acpi.sleep_delay: 1
hw.acpi.s4bios: 0
hw.acpi.verbose: 0
hw.acpi.reset_video: 1
hw.acpi.cpu.cx_supported: C1/0
hw.acpi.cpu.cx_lowest: C1
hw.acpi.cpu.cx_usage: 100.00%
hw.acpi.thermal.min_runtime: 0
hw.acpi.thermal.polling_rate: 10
hw.acpi.thermal.tz0.temperature: 8.3C
hw.acpi.thermal.tz0.active: -1
hw.acpi.thermal.tz0.passive_cooling: 1
hw.acpi.thermal.tz0.thermal_flags: 0
hw.acpi.thermal.tz0._PSV: 9.8C
hw.acpi.thermal.tz0._HOT: -1
hw.acpi.thermal.tz0._CRT: 31.3C
hw.acpi.thermal.tz0._ACx: -1 -1 -1 -1 -1 -1 -1 -1 -1 -1








More information about the freebsd-acpi mailing list