LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   how to tell if system is rebooting from a crash/power failure? (https://www.linuxquestions.org/questions/linux-general-1/how-to-tell-if-system-is-rebooting-from-a-crash-power-failure-806653/)

trey85stang 05-08-2010 10:09 AM

how to tell if system is rebooting from a crash/power failure?
 
I'm trying to come up with a startup init script that will check to see if the system was shut down gracefully, or if it is rebooting from a poweroff or something similar?

Anyone know of a way to check for this condition with the least amount of room for false positives or vice versa?

My intial thought is just a startup script that will will check for a file on startup, and on a proper reboot/shutdown just touch the file. But id like to avoid that type of script if possible, Im sure there is some other way to test for this correctly.

Btw... this is a sles10sp2 system.

marafa 05-08-2010 12:01 PM

Quote:

Originally Posted by trey85stang (Post 3961370)
I'm trying to come up with a startup init script that will check to see if the system was shut down gracefully, or if it is rebooting from a poweroff or something similar?

Anyone know of a way to check for this condition with the least amount of room for false positives or vice versa?

My intial thought is just a startup script that will will check for a file on startup, and on a proper reboot/shutdown just touch the file. But id like to avoid that type of script if possible, Im sure there is some other way to test for this correctly.

Btw... this is a sles10sp2 system.


see what happened last

trey85stang 05-09-2010 07:16 PM

dohh.. i totally forgot about that command. Thanks marafa!


All times are GMT -5. The time now is 09:30 AM.