Summary: Greping for certain process

From: Allen, Michael A. (Michael.Allen@jhuapl.edu)
Date: Mon Mar 08 1999 - 16:02:16 CST


Thx. for the quick responses. Responses are listed in the order I received
them. Plenty more are coming in, but number 3 worked for after slight
modification. The original posting is at the bottom. Great list!! -maa-

1.)
Dan Anderson recommended using Big Brother.
P.S. http://maclawran.ca/cgi-bin/newbb.pl

2.)
#!/bin/sh
#
# checkproc.sh
# Usage: checkproc process_name
#
PROC=`/usr/ucb/ps auxww | grep $1 | egrep -v "$0|grep" `
if [ ! "$PROC" ]
then
        echo "Process $1 not running" | mail root@yourserver.domain.org
fi

* gary franczyk

3.)
#!/bin/sh
unset TESTVAL
TESTVAL=`ps -ef | grep '[i]netd'`
if [ -n $TESTVAL ] ; then
   ps -ef | mailx -s 'inetd is not running' admin@your.host
fi;

Sweth Chandramouli

4.) My version:
unset TESTVAL

 TESTVAL=`ps -ef | grep '[i]netd'`

if [ -n $TESTVAL ] ;
then
: #do nothing
else
   ps -ef | mailx -s 'inetd is not running' mallen@aplcore.jhuapl.edu
fi;

> -----Original Message-----
> Subject: Greping for certain process
>
> Admins:
>
> Does anyone have any bourne shell code that'll grep for a certain process
> and mail the output if the process isn't running? I'll summarize.



This archive was generated by hypermail 2.1.2 : Fri Sep 28 2001 - 23:13:16 CDT