|
Search Forums:
|
|||||||
| Forums | Register | Forum Rules | Linux and Unix Links | Man Pages | Albums | FAQ | Users | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
|
|
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Homemade activity monitor-ish
Hello - I didn't find this with search, but I'm guessing it's out there somewhere. Apologies for reposting if that's the case.
I'm shell scripting on a 10.5.8 Mac. I want to make a program that runs in the background and periodically logs computer use, storing things like - cpu usage, programs running, etc. I know I can get the pid of the most recently called process with $!, but is there a way to get the pid of any arbitrary process, or even to see all pids in use at one time? Do all processes have single, unique pids? Is it possible to see the number of windows open at any one time? Thanks. |
| Sponsored Links | |
|
|
|
#2
|
||||
|
||||
|
Yes, all processes have a single unique pid. The ps command might help you. Not sure if this is the same switches on Mac, but you can get for example process stati with: Code:
ps aux where the STAT column might be interessting for you. The values are explained in the man page for ps so you might grep for the ones you'd like to see. Where you can see the number of open windows, I do not know. But maybe you can find them in some X log or also as processes or threads. Last edited by zaxxon; 09-06-2010 at 04:53 AM.. Reason: typo |
| Sponsored Links | ||
|
|
|
#3
|
|||
|
|||
|
Thanks so much. ps looks great.
|
| Sponsored Links | ||
|
|
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Commands to monitor other user's activity | Sotau | UNIX for Dummies Questions & Answers | 2 | 11-30-2009 10:23 AM |
| How to monitor system activity while executing tests | smovla | Shell Programming and Scripting | 2 | 06-22-2009 12:06 PM |
| Tool to monitor user activity | nana | UNIX for Dummies Questions & Answers | 3 | 07-15-2005 11:26 AM |
|
|