LinuxQuestions.org
Did you know LQ has a Linux Hardware Compatibility List?
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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!

Notices



Reply
 
Search this Thread
Old 08-10-2009, 07:38 PM   #1
prudens
Member
 
Registered: Jul 2009
Posts: 52

Rep: Reputation: 15
Emails myself when a process dies


Hallo,

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.

Thanks!
 
Old 08-10-2009, 08:45 PM   #2
choogendyk
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, 08:52 PM   #3
i92guboj
Gentoo support team
 
Registered: May 2008
Location: Lucena, Córdoba (Spain)
Distribution: Gentoo
Posts: 4,049

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

Code:
#!/bin/sh
<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, 09:09 PM   #4
prudens
Member
 
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, 04:02 AM   #5
centosboy
Senior Member
 
Registered: May 2009
Location: london
Distribution: centos5
Posts: 1,137

Rep: Reputation: 116Reputation: 116
Quote:
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 04:04 AM.
 
  


Reply


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


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

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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration