2

Depending on the restart of the system, I need to make my application taking some follow up.

my system is get restarted as following:

  1. my self as system admin rebooting sudo init 6 or sudo reboot
  2. my self as system admin init 0 or sudo shutdown
  3. NOT myself, System crash of get frozen and hangs (physically power off and power on)
  4. 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?

  • 1
    you can create a file somewhere as a flag for successful boot and delete the file through the regular shutdown/restart procedure. If during the boot you find the file not deleted - that means a failed reboot. Maybe content of the file also can be indicative. – jet Sep 19 '13 at 22:52
1

You might want to have a look at the last command.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.