How to detect pending system shutdown on Linux?
问题 I am working on an application where I need to detect a system shutdown. However, I have not found any reliable way get a notification on this event. I know that on shutdown, my app will receive a SIGTERM signal followed by a SIGKILL . I want to know if there is any way to query if a SIGTERM is part of a shutdown sequence ? Does any one know if there is a way to query that programmatically (C API)? As far as I know, the system does not provide any other method to query for an impending