BSD Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsOperating SystemsBSD Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now!
  #1  
Old January 3rd, 2005, 03:48 PM
goofball goofball is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2004
Posts: 14 goofball User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 4 h 1 m 24 sec
Reputation Power: 0
Lookup script filename by PID

I'm using the "top" and "ps" commands to look up PID's on a FreeBSD machine, but in the readout from top where the command column reads "perl", there's no way to tell which of my scripts started the process.

Does anyone know of a way to lookup the filename of a script by the PID?

Reply With Quote
  #2  
Old January 4th, 2005, 11:29 AM
stevengs stevengs is offline
Permanently Banned
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2004
Location: Germany
Posts: 394 stevengs User rank is Lance Corporal (50 - 100 Reputation Level)stevengs User rank is Lance Corporal (50 - 100 Reputation Level)stevengs User rank is Lance Corporal (50 - 100 Reputation Level) 
Time spent in forums: 3 Days 4 h 36 m 24 sec
Warnings Level: 10
Number of bans: 1
Reputation Power: 0
Hi GoofBall,

the ps man page shows how to view the PPID.. that is the Parent PID. You can add it to the ps output a number of ways, for example with the -j switch:

Code:
[steven@Napoleon 18:24:55]
~ > ps -j
USER     PID  PPID  PGID   SID JOBC STAT  TT       TIME COMMAND
steven  6426  6425  6426  6426    0 Ss    p0    0:00.06 -bash (bash)
steven  6464  6426  6464  6426    1 R+    p0    0:00.00 ps -j
steven  6396 91051  6396 91051    1 I+    v0    0:00.04 -bash (bash)


with that you can backtrack and usually figure out where a process initiated.

does that help?

MfG

Steven
"You ride a horse rather less well than another horse would!", - Edmund Black Adder

Last edited by stevengs : January 4th, 2005 at 11:34 AM.

Reply With Quote
  #3  
Old January 4th, 2005, 04:25 PM
goofball goofball is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2004
Posts: 14 goofball User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 4 h 1 m 24 sec
Reputation Power: 0
Yeah, I think the the ps utility will do.
I tried it before - without any flags - and as a result could only see the processes owned by me (root) which were ssh commands and therefore didn't look anything like the Perl script file name I was looking for in a greedy process. That's why I couldn't make sense out of it. I don't know why, but it didn't even occur to me to check for a man page ...

%> ps -a

shows all processes from all users, and a full path under the command column.

Thanks for posting back!

Reply With Quote
Reply

Viewing: Dev Shed ForumsOperating SystemsBSD Help > Lookup script filename by PID


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway