LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 10-18-2017, 03:31 AM   #1
Sol33t303
Member
 
Registered: Jul 2017
Distribution: gentoo
Posts: 115

Rep: Reputation: Disabled
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?
 
Old 10-18-2017, 07:24 AM   #2
rtmistler
Moderator
 
Registered: Mar 2011
Location: USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu, Debian
Posts: 9,882
Blog Entries: 13

Rep: Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930
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.
 
Old 10-18-2017, 07:48 AM   #3
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 10,659
Blog Entries: 4

Rep: Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941
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.
 
2 members found this post helpful.
Old 10-18-2017, 07:54 AM   #4
rtmistler
Moderator
 
Registered: Mar 2011
Location: USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu, Debian
Posts: 9,882
Blog Entries: 13

Rep: Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930
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.
 
Old 10-18-2017, 08:05 AM   #5
YesItsMe
Member
 
Registered: Oct 2014
Posts: 915

Rep: Reputation: 313Reputation: 313Reputation: 313Reputation: 313
Quote:
Originally Posted by Sol33t303 View Post
I want to setup a script that texts me when my server has crashed
You might be interested in Nagios.
 
Old 10-18-2017, 11:22 AM   #6
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 19,872
Blog Entries: 12

Rep: Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053
Quote:
Originally Posted by YesItsMe View Post
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.

Last edited by ondoho; 10-19-2017 at 01:00 AM.
 
1 members found this post helpful.
Old 10-18-2017, 11:28 AM   #7
YesItsMe
Member
 
Registered: Oct 2014
Posts: 915

Rep: Reputation: 313Reputation: 313Reputation: 313Reputation: 313
You know that a Direct Message is the preferred way to annoy other LQ members without causing any disruption?
 
1 members found this post helpful.
Old 10-21-2017, 03:08 AM   #8
Sol33t303
Member
 
Registered: Jul 2017
Distribution: gentoo
Posts: 115

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by sundialsvcs View Post
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.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Linux Kernel Panics theunixwizard Linux - Kernel 1 02-16-2008 12:21 PM
Kernel panics when installing linux - windows mostly works Captain Tram Linux - Hardware 12 03-27-2007 05:11 PM
Kernel 2.4.23 compile causes kernel panics on ATA RAID-1 (mirror) array Raptor Ramjet Slackware 3 12-18-2003 01:40 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 05:07 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration