问题
Which are the approach (simplest possible) that we can use to get notified for Power Status changes (for instance when computer goes to sleep, hibernate, etc.) in Linux based systems?
I will need this mainly for persisting some state before sleeping, and of course, restoring that state once the computer wakes up.
回答1:
You can get all these events by just configuring your acpid to send them via socket, for example.
There's an official specification document that describes all possible events and circumstances. An extensive read though.
来源:https://stackoverflow.com/questions/8067768/power-management-notifications-in-linux