I am using below command to get the pid . "A" is application name and used as parameter. I run my script like ./stop A
PID=`ps -ef | grep A| grep -v grep | awk '{print$2}'`
This is capturing " /bin/ksh ./stop A " process as well .But that I do not want. I only want process of "A" to be captured not my script process in PID/
I have below kill command under my script that is killing my running script :(
kill -9 $PID
It is killing pid of /bin/ksh ./stop A
itself also and script is getting stopped at that point .
This is for AIX. How to avoid killing the script itself.
NOTE: When i am working with the same script to do same work but without passing argument it is going good. I believe its obvious as passing an argument to script is creating other pid and for the same application its doing grep and killing.