Share your knowledge at the LQ Wiki.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 08-10-2009, 06:38 PM   #1
Registered: Jul 2009
Posts: 52

Rep: Reputation: 15
Emails myself when a process dies


First I just wanna say that LQ is THE BEST Linux forums on the whole WWW... If I had unlimited money, I would donate no question at all!

OKej, now my question. How do I mail myself if a certain process dies on my server? My mail server is with Google Apps.

Old 08-10-2009, 07:45 PM   #2
Senior Member
Registered: Aug 2007
Location: Massachusetts, USA
Distribution: Solaris 9 & 10, Mac OS X, Ubuntu Server
Posts: 1,189

Rep: Reputation: 105Reputation: 105
Not enough detail. Process on which server? What is it running? What's it's OS? And then your email ISP is Google Apps?

Without enough detail to really know, I might suggest a cron job that runs every few minutes and checks to see if that process is running. If it is not, use a command line email such as mailx to send a mail to your address. Of course, your server needs to be configured so that it can do that.
Old 08-10-2009, 07:52 PM   #3
Gentoo support team
Registered: May 2008
Location: Lucena, Córdoba (Spain)
Distribution: Gentoo
Posts: 4,052

Rep: Reputation: 379Reputation: 379Reputation: 379Reputation: 379
The absolute easiest way would be to launch the process wrapped into a shell script, like this one:

<whatever_command> || <command to send mail>
This will send you an email each time a process dies with a non-zero status (which means it terminated with an error of some kind). I guess that's what you mean with "when a process dies". It won't send an email when the process ends without error or when it's killed by either you or init 6 (when halting your machine). But it all comes down to what do you mean by "die".
Old 08-10-2009, 08:09 PM   #4
Registered: Jul 2009
Posts: 52

Original Poster
Rep: Reputation: 15
Say I have a process called PROCESS1 with a PID of 99999.

When It dies a email is sent to me. I use Google Apps.

Also, I use webmin... any easy ways?
Old 08-11-2009, 03:02 AM   #5
Senior Member
Registered: May 2009
Location: london
Distribution: centos5
Posts: 1,137

Rep: Reputation: 116Reputation: 116
Originally Posted by prudens View Post
Say I have a process called PROCESS1 with a PID of 99999.

When It dies a email is sent to me. I use Google Apps.

Also, I use webmin... any easy ways?

easy way is what i92guboj quoted above or some sort of shell or perl script that checks every so minutes and if it doesnt find a process that matches a name - then sends an alert.

best way is set up some sort of monitoring system.

nagios, zabbix, open nms, there is a big choice.

Last edited by centosboy; 08-11-2009 at 03:04 AM.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Oracle eBusiness Java process hangs then dies MensaWater Linux - Software 2 07-16-2009 10:28 AM
bash `kill`: process 'B' silently dies; but process 'A' = `kill` spews back debris! GrapefruiTgirl Programming 9 06-23-2009 09:42 AM
Releasing RWLocks from SHM when process dies rajkiran.ravi Programming 4 12-08-2008 08:59 AM
how to identify a zombie process and control it after parent dies vijaya_svk Programming 1 01-21-2008 04:44 AM
Red Hat AS 4, Nic dies during boot process zmag2linux Red Hat 1 04-20-2007 04:56 PM

All times are GMT -5. The time now is 03:14 PM.

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