Log power button

Michael Powell nightrecon at hotmail.com
Thu Jan 28 16:32:20 UTC 2016


Arthur Chance wrote:

> On 27/01/2016 18:55, Andrea Venturoli wrote:
>> Hello.
>>
>> A server of mine (10.1) is "spontaneusly" rebooting.
>> This is not a power failure/panic/crash/whatever, since it properly
>> shuts down.
>>
>> I suspect someone is pushing the power button, but I have no physical
>> way to check. Problem is, this is not reported in the logs.
>>
>> I vaguely remember older FreeBSD versions did this once, but I might be
>> wrong; I cannot check on this box (100km away), but I tried on another
>> one and, to my surprise, the fact that I pressed the power button was
>> NOT logged.
>>
>> Is there any way to enable this?
>> Maybe I'm dumb, but I looked for this and found nothing.
> 
> It's not an area I'm that familiar with so double check this, but take a
> look towards the end of /etc/devd.conf, where there's a comment about
> ACPI notify handlers. There's a "Button" subsystem related to power and
> sleep buttons. You probably want a devd rule that looks something like
> 
> notify 0 {
> match "system"		"ACPI";
> match "subsystem"	"Button";
> match "notify"		"0";
> action	"logger -p daemon.alert Power button pressed";
> }
> 
> I can't guarantee that will work, I've never tried it, but it's a place
> to start.
> 

Also, in many BIOS of today there is a place to set what the ACPI action 
will be, ala: power off immediate upon press vs power off after press and 
hold 4 seconds is very common.

-Mike




More information about the freebsd-questions mailing list