![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !! |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Getting exact time | tdst | UNIX for Dummies Questions & Answers | 1 | 08-11-2006 02:58 PM |
| How to grep the exact name? | csaha | Shell Programming and Scripting | 3 | 01-31-2006 11:47 AM |
| Echo-exact | matthewwithanm | Shell Programming and Scripting | 1 | 08-17-2005 01:38 AM |
| process filtering | pradeepmacha | Shell Programming and Scripting | 6 | 04-11-2005 11:18 AM |
| what is the exact reason ? | shamal | High Level Programming | 2 | 12-08-2001 01:13 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Filtering exact process name from ps
Hi Gurus,
I have two processes running on a Unix box, named say, PRCS1 and PRCS1X. I want to check whether process PRCS1 is running or not, and depending on that I have to make further decisions while writing a shell script. I am using: ps -eaf|grep PRCS1|grep -v grep But the problem is the above command returns the process details of PRCS1X as well, even when the process PRCS1 is not up and running. I wanted to look-up for the exact process-name PRCS1; nothing more or less. I also tried: ps -eaf|grep "PRCS1"|grep -v grep .... plz forgive my ignorance, I'm not a Guru in Unix. Can anyone suggest a better way to accomplish this? Thanks in advance, Sagar |
|
||||
|
Code:
ps aux | egrep 'PRCS1[^X]' | grep -v grep ps aux | egrep 'PRCS1X' | grep -v grep Though it may be way more elegant to try to identify them based on pids. Do they generate pid files under /var/run ? You could just check for the existence of files, then the existence of /proc/pid-number where pid-number is the contents of the pid file. |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|