There is a lot about the "procedure" LINUX undertakes when a reboot or 'imminent shutdown' is underway. I wish to understand, programmatically, and react to, that a REBOOT IS IMMINIENT.
My application gets sent TERM and HUP signals which is all good and understood. How can I tell the difference between a signal for immediate REBOOT reasons or just from another user?
CONTEXT:
If the system is 100% rebooting then my application will SAVE IT's STATE for LOAD on BOOT.
If however, a user, even "root" arbitrately kills my application then I DO NOT WISH to save the STATE.
I am using RedHat if it makes a difference.
I have attempted to research this quite extensively but so far I have not got the solution. So you know... calling STACK OVERFLOW!
Thank you in-advance.
This will is created if the system is using systemd.