Depending on the restart of the system, I need to make my application taking some follow up.
my system is get restarted as following:
- my self as system admin rebooting sudo init 6 or sudo reboot
- my self as system admin init 0 or sudo shutdown
- NOT myself, System crash of get frozen and hangs (physically power off and power on)
- NOT myself, System off, power failure (physically need to power on)
Now, when I am not involved the system is either having reboot or shutdown where I have no, idea for those cases.
But in my every power down/power off I have one preset problem where second hardware I need to send commands for setting configuration which match with my box.
So, how can I detect the previous actions? Was it frozen, was it shutdown, was it reboot or was it etc. etc. So that I can on boot read the log and take related actions?