How to detect power system events such as suspension, hibernation, etc.

I want to make a Linux application that sends a message to a remote host when the local system (where the application starts) is about to suspend, hibernate or shut down. I googled how to do this and found acpi_listen, but it does not work.

Here is the result ps aux | grep acpion the system under test (Ubuntu 10.04 LTS):

root        35  0.0  0.0      0     0 ?        S    Dec03   0:00 [kacpid]
root        36  0.0  0.0      0     0 ?        S    Dec03   0:00 [kacpi_notify]
root        37  0.0  0.0      0     0 ?        S    Dec03   0:00 [kacpi_hotplug]
root       934  0.0  0.0   2048   872 ?        Ss   Dec03   0:00 acpid -c /etc/acpi/events -s /var/run/acpid.socket

Communicating with acpid directly through a UNIX domain socket will not work, since acpi_listen works, although I have not tried it. Is there another way?

+3
source share
1 answer

Listen to them through the D-Bus .

+5
source

Source: https://habr.com/ru/post/1779595/


All Articles