Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I need to monitor hanging processes on the output of ps -ef | grem GMC...

What's the best way to do this without running this command manually and being stuck in front of a command line all day? I'd like to our dev team to get an email whenever one of these processes hangs so we can investigate, or better yet, auto-killing dying processes.

SUSE Linux Enterprise Server 10 (x86_64)
Novell Open Enterprise Server 2 (x86_64)
share|improve this question
if you know what output you're looking for from the ps command, it should be as simple as writing a script and putting it in a cron – sreimer Apr 13 '11 at 19:00
What happens when the process hangs ? – Iain Apr 13 '11 at 19:28

A simple script like the one following does the magic:


PROCESS=`ps auxw | grep GMC | grep -v grep`

if [ -z $PROCESS ]; then
  echo "Process GMC not running" | mail -s "Alert"

Then run this every 5 minutes from your crontab.

You might also want to check tools like daemontools or monit. Both these tools are open source utilities that check processes and restart them if they're not running.

Hope this helps!

share|improve this answer
Will this tell me when it's stalled? – Webnet Apr 13 '11 at 20:25
you can tune the script to do that as well. – Marco Ramos Apr 13 '11 at 21:05
How can I do that? – Webnet Apr 14 '11 at 12:36
Does the process write some kind of output/log? – Marco Ramos Apr 14 '11 at 18:20
What happens the the process hangs? – Marco Ramos Apr 14 '11 at 18:21

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.