In windows, when the system goes to sleep state or hibernate state, it sends a WM_POWERBROADCAST message with PBT_APMSUSPEND parameter to all the applications about the system going to sleep state. I want to know, if there is a way in linux to receive the power messages.

Your help will be much appreciated.

Many thanks.