send an email when a process goes down

Posted on 2007-08-10
Last Modified: 2013-12-16

We are moving to Red Hat Linux and I was wondering if linux had something like

If a process is shut down - send email
If a process is using more than x gb of memory send an email


can we write a shell script for that.
Question by:anshuma
    LVL 43

    Accepted Solution

    So far I know, no.

    But I'm doing this very thing by myself. I created /root/bin/check_up script with following content


    ps -C qmail-send >/dev/null 2>&1 || MSG="$MSG; qmail is not running"
    #more checks
    LARGEST=$( ps -eo vsize | sort -nr | head -n1 )
    if [ -n "$MSG" -o $LARGEST -gt 102400 ]; then #some stopped, or largest > 100M
     TENLARGE=$( ps -eo vsize,rss,pid,cmd | sort -nr | head -n10 )
     echo -e "$MSG\nlargest procs:\n$TENLARGE" | mail -s "died processes detected"
    Then ust add it to cron for regular runs
    LVL 28

    Assisted Solution

    by:Jan Springer
    You should look into Nagios and Nagios plugins.  This will accomplish what you want.

    Featured Post

    Maximize Your Threat Intelligence Reporting

    Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

    Join & Write a Comment

    Suggested Solutions

    Currently, there is not an RPM package available under the RHEL/Fedora/CentOS distributions that gives you a quick and easy way to allow PHP to interface with Oracle. As a result, I have included a set of instructions on how to do this with minimal …
    Setting up Secure Ubuntu server on VMware 1.      Insert the Ubuntu Server distribution CD or attach the ISO of the CD which is in the “Datastore”. Note that it is important to install the x64 edition on servers, not the X86 editions. 2.      Power on th…
    Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
    Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.

    731 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    17 Experts available now in Live!

    Get 1:1 Help Now