SUMMARY: Simple Shell Script HELP

From: Bhavesh Shah (bshah@citadon.com)
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; sunmanagers@sunmanagers.org
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: "./Test.sh **ora_pmon_pnet*** PNET"

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

Thanks
B

-----Original Message-----
From: Bhavesh Shah
Sent: Tuesday, May 03, 2005 2:58 PM
To: sunmanagers@sunmanagers.org
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.

Test.sh

------------------------------------------------------------------------
------------------------------

#! /bin/ksh

if [ $# -ne 2 ]

then

echo "Invalid Syntax....."

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

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

exit 1

fi

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

./Test.sh 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.

Regards

B
_______________________________________________
sunmanagers mailing list
sunmanagers@sunmanagers.org
http://www.sunmanagers.org/mailman/listinfo/sunmanagers
_______________________________________________
sunmanagers mailing list
sunmanagers@sunmanagers.org
http://www.sunmanagers.org/mailman/listinfo/sunmanagers



This archive was generated by hypermail 2.1.7 : Wed Apr 09 2008 - 23:30:38 EDT