The options on ps vary greatly from one OS
to another. Use your system's man command
to find the syntax of ps for your os.
The Proc::ProcessTable module gives you
a relatively OS independant way of getting
and working with
a process list.
--
lhoward
| [reply] [Watch: Dir/Any] |
Your first question, how to find the process id for a process running completely independent of your perl script, you can use ps.
As for your second question, the syntax for ps can differ depending on which UNIX architecture you're on, which version of it, and even which version of ps is installed. A good place to start is by looking at the man page for ps.
What confuses me is that you as about ps, but you also mention calc.exe running. This sounds like a Windows app, not UNIX. There's no ps (without some toolkit) native to windows.
For windows, I can suggest either getting one of these toolkits (such as the Resource Kits), or using a perl module (a quick search for one didn't turn up anything, but there's probably one out there).
Hope that helps.
Update: Suggested by lhoward, Proc::ProcessTable is the perl module you're looking for.
| [reply] [Watch: Dir/Any] |
ps -C program_name
From the Chatterbox earlier today, you were wanting to kill all the apache PID's with Perl...
shell> ps -C httpd | perl -pe '($_)=/(\d+)/;`kill -9 $_`'
That should work as root
Enjoy!
--
Casey
| [reply] [Watch: Dir/Any] [d/l] |
ps -C httpd|perl -ne'($_)=/(\d+)/;`kill -9 $_` if $_'
That seems better to me.
--
Casey
| [reply] [Watch: Dir/Any] [d/l] |
| [reply] [Watch: Dir/Any] |