Linux - NewbieThis 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
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Distribution: Solaris 9 & 10, Mac OS X, Ubuntu Server
Posts: 1,197
Rep:
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.
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".
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.