LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Is it possible to get linux to run a script when the kernel panics? (https://www.linuxquestions.org/questions/linux-software-2/is-it-possible-to-get-linux-to-run-a-script-when-the-kernel-panics-4175615880/)

Sol33t303 10-18-2017 03:31 AM

Is it possible to get linux to run a script when the kernel panics?
 
I want to setup a script that texts me when my server has crashed, so is it possible to do that? If so how could i?

rtmistler 10-18-2017 07:24 AM

No.

A kernel panic is a crash of the kernel.

The OS is no longer running.

A shell script cannot run without a shell.

The shell is not running when the OS is not running.

sundialsvcs 10-18-2017 07:48 AM

As rtmistler said, a kernel panic occurs when the kernel cannot continue to run, and the entire system stops cold.

Unlike an "Oops!", which is a recoverable kernel error, a kernel panic is instant system death.

An external monitoring agent, such as Nagios, can be used to detect when a machine has become unresponsive and possibly to take action. Virtual-machine monitors can also detect when a virtual machine has died.

rtmistler 10-18-2017 07:54 AM

And the very, very sad part I'm realizing just now is that there specifically a Sticky thread discussing kernel panics

Created by sundialsvcs, which I helped to post over in the Linux - Newbie forum.

YesItsMe 10-18-2017 08:05 AM

Quote:

Originally Posted by Sol33t303 (Post 5771187)
I want to setup a script that texts me when my server has crashed

You might be interested in Nagios.

ondoho 10-18-2017 11:22 AM

Quote:

Originally Posted by YesItsMe (Post 5771261)
You might be interested in Nagios.

you know you can subscribe to a thread without posting to it?
just saying...

edit: i realize in retrospect that sundialsvcs' mention of nagios is not immediately visible to anyone, so my veiled criticism might've been a little harsh. my apologies.

YesItsMe 10-18-2017 11:28 AM

You know that a Direct Message is the preferred way to annoy other LQ members without causing any disruption?

Sol33t303 10-21-2017 03:08 AM

Quote:

Originally Posted by sundialsvcs (Post 5771254)
As rtmistler said, a kernel panic occurs when the kernel cannot continue to run, and the entire system stops cold.

Unlike an "Oops!", which is a recoverable kernel error, a kernel panic is instant system death.

An external monitoring agent, such as Nagios, can be used to detect when a machine has become unresponsive and possibly to take action. Virtual-machine monitors can also detect when a virtual machine has died.

Thanks for suggesting Nagios, i've just installed it and it seems to be working great, but is there anyway to control it from the command line? I was looking into this project https://github.com/tehmaze/nagios-cli but after installing it it doesn't seem to work so i think it might be outdated, it would be much easier for me to put nagios into my script if were operable on the command line. I haven't done much with servers before so hadn't heard of nagios but it seems to be really popular. I thought that with a kernel panic perhaps the kernel is at least slightly operable before it decided to shutdown, but it sounds like when the kernel panics that it's to late to do anything about it other than restart the PC manually, but it seems like that a kernel oops often leads to a kernel panic so i'll try to get my server to message me when that happens instead.


All times are GMT -5. The time now is 08:13 AM.