Re: korn shell scripts help

From: Raj Ramakrishnan (RRamakri@MTABT.ORG)
Date: Fri Jun 21 2002 - 11:35:24 EDT


Thanks a lot

>>> SGreen@krafteurope.com 06/20/02 10:42PM >>>

Try...
ps -ef|grep -q [o]ra_smon_raas

if [[ $? -eq 0 ]]
then
 snmptrap...
fi

The square brackets around the first character ensure that the grep command itself isn't picked up.
-q is just "quiet"; all you're interested in is the return code. "0" indicates found; "1" not found.

Simon Green
Philip Morris ITSC Europe

AIX-L Archive at http://marc.theaimsgroup.com/?l=aix-l&r=1&w=2
AIX FAQ at http://www.faqs.org/faqs/aix-faq/

N.B. Unsolicited email from vendors will seldom be appreciated.
-----Original Message-----
From: Raj Ramakrishnan [mailto:RRamakri@MTABT.ORG]
Sent: 20 June 2002 21:24
To: aix-l@Princeton.EDU
Subject: korn shell scripts help

Hi all

I need help writing this script when I execute this command

ps -ef | grep ora_smon_raas ( if the output this )

  root 22010 47030 1 16:12:31 pts/0 0:00 grep ora_smon_raas
  oracle 31582 1 0 08:30:53 - 0:08 ora_smon_raas

then execute this command

snmptrap -v 2c -c public localhost "" .1.3.6.1.4.1.2021.251.1

ps -ef | grep ora_smon_raas (If the output this )

root 22010 47030 1 16:12:31 pts/0 0:00 grep ora_smon_raas

then do not execute this command.

snmptrap -v 2c -c public localhost "" .1.3.6.1.4.1.2021.251.1



This archive was generated by hypermail 2.1.7 : Wed Apr 09 2008 - 22:16:00 EDT