find pid of process run in specific location

Thread Tools Search this Thread
Top Forums Shell Programming and Scripting find pid of process run in specific location
# 1  
Old 07-28-2009
find pid of process run in specific location


I have a process a.out that runs from /a and /b
How can I get the pid of the one running from /a
ps -C /a/a.out
does not work

# 2  
Old 07-28-2009

Have a look at the manpage for fuser command.
lsof is another tool often used to identify processes.
# 3  
Old 07-28-2009
Hi Cero,
Thank you very much; I did not know those commands.

a.out is actually a fastcgi program and I need to kill every running processes of that program. Would
fuser -k /a/a.out
do the trick?
I am a bit confused because the man page of fuser reads:
-k Kill processes accessing the file. Unless changed with -signal, SIGKILL is sent. An fuser process never kills itself, but may kill other fuser processes. The effective user ID of the process executing fuser is set to its real user ID before attempting to kill.
# 4  
Old 07-29-2009
fuser -k should do the trick. The manpage tells you that the privileges of your user are used when trying to kill the process.
For fuser the setuid-bit is set (at least on AIX) :
ls -la /usr/sbin/fuser
-r-sr-xr-x   1 root     system        19084 Mar 16 2007  /usr/sbin/fuser

This means that the process running the fuser command operates with root-privileges (= it's effective user ID is root), which would allow you to kill any process with this command. To prevent this the process switches back to the user you logged on and operates with those privileges before attempting to kill another process.

Did this clear things up for you?
# 5  
Old 07-29-2009
a.out is actually a fastcgi program and I need to kill every running processes of that program
man pkill
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Find and Copy file of specific location

Dear All, I need to transfer all files present in one location to another but those files should be of specific extension like. Find and copy all files of extension .xls, .pdf, .txt from location usr/tmp to location /per/Treat (6 Replies)
Discussion started by: yadavricky
6 Replies

2. Shell Programming and Scripting

Find the Pid and Kill the Process after a Few Minutes

hi guys i had written a shell script Display Information of all the File Systems i want to find the pid and kill the process after few can i obtain the pid and kill it??? df -a >> /tmp/size.log and my cron to execute every minute every hour every day * *... (5 Replies)
Discussion started by: azherkn3
5 Replies

3. UNIX for Dummies Questions & Answers

Help with simple script to find PID of process

Hi everyone. I've been reading around and am a little bit overwhelmed, hoping to find a kind soul out there to hold my hand through writing my first script. This need has emerged at work and I haven't much experience writing shell scripts, but this is a problem we have with a production environment... (13 Replies)
Discussion started by: thirdcoaster
13 Replies

4. Shell Programming and Scripting

Find PID for a process

I want to kill a process run by a user of another group. How do I do that..? (3 Replies)
Discussion started by: Haimanti
3 Replies

5. Solaris

how to find PID of a runnign process ?

Hi Friends, How can we find the process ID of a running process using the process name. In AIX I used to use the command "ps -ef | grep <process name>", it used to give me the owner of that process, Process ID and the threads running and the name of the process in the end. However in... (2 Replies)
Discussion started by: sahilsardana
2 Replies

6. Shell Programming and Scripting

Find and replace a string a specific value in specific location in AIX

Hi, I have following samp.txt file in unix. samp.txt 01Roy2D3M000000 02Rad2D3M222222 . . . . 10Mik0A2M343443 Desired Output 01Roy2A3M000000 02Rad2A3M222222 . . (5 Replies)
Discussion started by: techmoris
5 Replies

7. Shell Programming and Scripting

Run a process but on a certain pid

Hi all, I am having a little bit of trouble trying to find something out. I am trying to script a start/stop php file, for some gaming servers i host. The server have 2 lots of processes running on them, and the customers need to be able to start and stop them at their will. So i know how to... (1 Reply)
Discussion started by: Syth
1 Replies

8. UNIX for Dummies Questions & Answers

Run Processes Sequentially Using Process ID (PID)

Hi, I'm a newbie when it comes to using UNIX, and I'm hoping someone here can help me out. I have a set of processes that I want to run sequentially: I want to know I can run these sequentially using their process IDs (PIDs). Ideally, I want to... (2 Replies)
Discussion started by: shelata
2 Replies

9. Shell Programming and Scripting

Find shell process pid launched throug `at`.

Hi. I was testing some staff and wrote simple script, which only writes date to log every 15 seconds. Like that while true;do echo `date` >> 1.log sleep 15 done And than i ran this process with `at -s -f now`. And now it is running and i don't know how to catch it. I tryed... (1 Reply)
Discussion started by: kukuruku
1 Replies

10. UNIX for Dummies Questions & Answers

How to find the details of the previously running process with PID

OS: Unix or Linux I (only) know the pid of the process which was running earlier (say 5 hrs back) but it is not running now. Is there a way I could find the details of that process? (atleast the name of the process). Please let me know. (2 Replies)
Discussion started by: vijay.d
2 Replies
Login or Register to Ask a Question