Processes

WeeZer51402

Registered
Is there any way with the 'top' utility that i could parse processes for instance say all i wanted to see were afp processes but only user afp processes and there pid? im not sre if top will do that but is there another utility that will?
 
I am not on my mac but a good unix tool for that is pgrep but I don't know if it comes installed :( You can check quicker than I.
 
no its not on my system(10.2.6) but maybe if i keep looking around i might be able to find the source code and just recompile it, anybody know of any other methods?
 
This is usually a task for 'ps' rather than for 'top'.

> ps uxcU afp

would generate a top-like output for a given user.
 
is there a way to specify all users with the 'U' flag instead of just one so that way i could view all user processes associated with afp?
 
i tried using 'ps acxu | grep smbd' to monitor Samba processes but ps is telling me that root owns all the smbd processes, not the user that they should be associated with?
 
Originally posted by WeeZer51402
i tried using 'ps acxu | grep smbd' to monitor Samba processes but ps is telling me that root owns all the smbd processes, not the user that they should be associated with?

Yes and no. The smbd process is owned by root when it's doing housekeeping type actions, such as writing to the log.hostname file of the connected client. When the user is actively reading/writing files the smbd process will change ownership to the user. It changes back when it needs to do housekeeping again.

Back to your original question, I'm assuming because you mentioned smbd, you're trying to monitor users using Samba? If thats the case you want to use the smbstatus command. That lists all the users connected to samba, whats shares they have, what files are open, and the pid of the smbd process they are associated with.

Brian
 
Back
Top