0

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)
VERSION = 10
PATCHLEVEL = 1
LSB_VERSION="core-2.0-noarch:core-3.0-noarch:core-2.0-x86_64:core-3.0-x86_64"
Novell Open Enterprise Server 2 (x86_64)
VERSION = 2
BUILD = FCS
Marco Ramos
  • 3,100
  • 22
  • 25
Ben
  • 3,630
  • 17
  • 62
  • 93

1 Answers1

2

A simple script like the one following does the magic:

#!/bin/bash

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

if [ -z $PROCESS ]; then
  echo "Process GMC not running" | mail -s "Alert" yourmail@address.com
fi

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!

Marco Ramos
  • 3,100
  • 22
  • 25