SUMMARY: Simple Shell Script HELP

From: Bhavesh Shah <>
Date: Tue May 03 2005 - 18:38:23 EDT
Sorry by mistake replied to ALL.
Its just a SUMMARY

-----Original Message-----
From: Bhavesh Shah
Sent: Tuesday, May 03, 2005 3:38 PM
To: Bhavesh Shah;
Subject: RE: Simple Shell Script HELP

Thanks for your quick responses....
Special Thanks to Alex.

The Problem was:
I was getting two "ora_pmon_pnet" strings from the output of the "ps
-ef" command. One from the process I am looking for, and the other one
from my own script execution: "./ **ora_pmon_pnet*** PNET"

Just need to add one more pipe with $0 (grep -v $0)


-----Original Message-----
From: Bhavesh Shah
Sent: Tuesday, May 03, 2005 2:58 PM
Subject: Simple Shell Script HELP

Hi Gurus,

I need some help in Shell scripting...

I have written a simple shell script which checks for Process ID. This
script has to pass two parameters ($1 and $2) (required)

The problem is Monitor variable somehow grep's for two Process IDs
instead of one.


#! /bin/ksh

if [ $# -ne 2 ]


echo "Invalid Syntax....."

echo "Correct Syntax is: $0 DB_INSTANCE ENV (PNET |MPROD)"

echo "Please Try with $0 ora_pmon_pnet PNET..."

exit 1


echo "ps -ef |grep "$1" | grep -v grep |  awk '{print $2}' "

Monitor=$(ps -ef |grep "$1" | grep -v grep |  awk '{print $2}')

echo $Monitor


Execute the Script

./ ora_pmon_pnet PNET

ps -ef |grep ora_pmon_pnet | grep -v grep |  awk '{print $2}'

26708 266221

Any Help/Pointer will be greatly appreciated.


sunmanagers mailing list
sunmanagers mailing list
Received on Tue May 3 18:38:56 2005

This archive was generated by hypermail 2.1.8 : Thu Mar 03 2016 - 06:43:46 EST