[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

OT: Windows equivalent of -ps

Dark Ambient

9/8/2006 9:36:00 AM

Sorry, but googling doesn't seem to be leading me anywhere. I have a
number o Ruby examples from books that demonstrate things using the
Unix ps command for system status. Can someone please tell me what is
the equivalent call in the Windows environment ?

TIA
Stuart

10 Answers

Jano Svitok

9/8/2006 9:49:00 AM

0

On 9/8/06, Dark Ambient <sambient@gmail.com> wrote:
> Sorry, but googling doesn't seem to be leading me anywhere. I have a
> number o Ruby examples from books that demonstrate things using the
> Unix ps command for system status. Can someone please tell me what is
> the equivalent call in the Windows environment ?

most probably pslist from sysinternals.com (NB: it's worth looking at
other tools there as well)

wannes

9/8/2006 9:50:00 AM

0

On 9/8/06, Dark Ambient <sambient@gmail.com> wrote:
> Sorry, but googling doesn't seem to be leading me anywhere. I have a
> number o Ruby examples from books that demonstrate things using the
> Unix ps command for system status. Can someone please tell me what is
> the equivalent call in the Windows environment ?

I always liked PsTools from sysinternals. I don't know the exact
output of it (don't have a windows pc at hand), but I think this is
what you are looking for:
http://www.sysinternals.com/Utilities/P...

grtz,
wannes

Paul Lutus

9/8/2006 9:52:00 AM

0

Dark Ambient wrote:

> Sorry, but googling doesn't seem to be leading me anywhere. I have a
> number o Ruby examples from books that demonstrate things using the
> Unix ps command for system status. Can someone please tell me what is
> the equivalent call in the Windows environment ?

There isn't one. Have you considered installing Linux? Commands like "ps"
are not platform-portable.

--
Paul Lutus
http://www.ara...

Dark Ambient

9/8/2006 10:12:00 AM

0

I've considered it but not feasible right now.
It's not like not having ps is really hurting me.

Stuart

On 9/8/06, Paul Lutus <nospam@nosite.zzz> wrote:
> Dark Ambient wrote:
>
> > Sorry, but googling doesn't seem to be leading me anywhere. I have a
> > number o Ruby examples from books that demonstrate things using the
> > Unix ps command for system status. Can someone please tell me what is
> > the equivalent call in the Windows environment ?
>
> There isn't one. Have you considered installing Linux? Commands like "ps"
> are not platform-portable.
>
> --
> Paul Lutus
> http://www.ara...
>
>

Daniel Berger

9/8/2006 11:57:00 AM

0

Dark Ambient wrote:
> Sorry, but googling doesn't seem to be leading me anywhere. I have a
> number o Ruby examples from books that demonstrate things using the
> Unix ps command for system status. Can someone please tell me what is
> the equivalent call in the Windows environment ?
>
> TIA
> Stuart
>
>
See sys-proctable, available on the RAA, which serves as a
cross-platform solution to boot.

http://raa.ruby-lang.org/project/sys-...

FYI, there are actually seven different ways to get process table
information on Windows, none of which are quite the same, and one of
which is undocumented. The sys-proctable version uses OLE + WMI on Windows.

Regards,

Dan

M. Edward (Ed) Borasky

9/8/2006 1:56:00 PM

0

Dark Ambient wrote:
> Sorry, but googling doesn't seem to be leading me anywhere. I have a
> number o Ruby examples from books that demonstrate things using the
> Unix ps command for system status. Can someone please tell me what is
> the equivalent call in the Windows environment ?
>
> TIA
> Stuart
>
>
I've seen some of the responses to this post, and I'm really curious.
Which books use examples that require "ps", and could you give some
examples of the use of "ps" in a Ruby script/program?

The reason I bring this up is that there are some times when doing "ps"
in a script is a very bad idea. Textbook examples that are OS-dependent
don't impress me all that much, either, outside of the obligatory "how
to get up and running on Windows, Linux, MacOS and Solaris" chapters.

Dark Ambient

9/8/2006 2:51:00 PM

0

Well off the top of my head right now -
The first recipe in Ruby Cookbook - in the Rails chapter

Second -
AWDWR 2nd edition in the Web2.0 Chapter.

I am pretty sure I saw it somewhere else as well, but it's not
surfacing right now.

Stuart
On 9/8/06, M. Edward (Ed) Borasky <znmeb@cesmail.net> wrote:
> Dark Ambient wrote:
> > Sorry, but googling doesn't seem to be leading me anywhere. I have a
> > number o Ruby examples from books that demonstrate things using the
> > Unix ps command for system status. Can someone please tell me what is
> > the equivalent call in the Windows environment ?
> >
> > TIA
> > Stuart
> >
> >
> I've seen some of the responses to this post, and I'm really curious.
> Which books use examples that require "ps", and could you give some
> examples of the use of "ps" in a Ruby script/program?
>
> The reason I bring this up is that there are some times when doing "ps"
> in a script is a very bad idea. Textbook examples that are OS-dependent
> don't impress me all that much, either, outside of the obligatory "how
> to get up and running on Windows, Linux, MacOS and Solaris" chapters.
>
>

Kenosis

9/8/2006 4:26:00 PM

0


Dark Ambient wrote:
> Well off the top of my head right now -
> The first recipe in Ruby Cookbook - in the Rails chapter
>
> Second -
> AWDWR 2nd edition in the Web2.0 Chapter.
>
> I am pretty sure I saw it somewhere else as well, but it's not
> surfacing right now.
>
> Stuart
> On 9/8/06, M. Edward (Ed) Borasky <znmeb@cesmail.net> wrote:
> > Dark Ambient wrote:
> > > Sorry, but googling doesn't seem to be leading me anywhere. I have a
> > > number o Ruby examples from books that demonstrate things using the
> > > Unix ps command for system status. Can someone please tell me what is
> > > the equivalent call in the Windows environment ?
> > >
> > > TIA
> > > Stuart
> > >
> > >
> > I've seen some of the responses to this post, and I'm really curious.
> > Which books use examples that require "ps", and could you give some
> > examples of the use of "ps" in a Ruby script/program?
> >
> > The reason I bring this up is that there are some times when doing "ps"
> > in a script is a very bad idea. Textbook examples that are OS-dependent
> > don't impress me all that much, either, outside of the obligatory "how
> > to get up and running on Windows, Linux, MacOS and Solaris" chapters.
> >
> >

I don't have my win pc at hand but you can try CygWin - its a pretty
comprehensive set of *nix tools and it may have a ps you can use.

James Britt

9/8/2006 5:30:00 PM

0

Dark Ambient wrote:
> Sorry, but googling doesn't seem to be leading me anywhere. I have a
> number o Ruby examples from books that demonstrate things using the
> Unix ps command for system status. Can someone please tell me what is
> the equivalent call in the Windows environment ?

If you are on WinXP (maybe also Win2k), try tasklist

I've been using it in a utility to monitor what apps I use.

tasklist /V

will report on these fields:

Image Name
PID
Session Name
Session#Mem Usage
Status
User Name
CPU Time
Window Title



--
James Britt

"Take eloquence and wring its neck."
- Paul Verlaine

M. Edward (Ed) Borasky

9/9/2006 3:56:00 AM

0

Dark Ambient wrote:
> Well off the top of my head right now -
> The first recipe in Ruby Cookbook - in the Rails chapter
I don't have that one handy, but I'll look it up

>
> Second -
> AWDWR 2nd edition in the Web2.0 Chapter.

Yeah ... page 513 in my Beta PDF. Comments:

1. Yeah, it's "UNIX" specific, and it says so in the text.

2. It's demonstrating regular updates and the "backquote" operator. I
assume the backquote works on Windows, so a better example might be some
command that would work on Windows, Linux and MacOS. Just off the top of
my head, the only thing I can recall is

`more logfile.txt`

3. Depending on the frequency and the number of processes, doing that
"ps" can impact performance severely. "ps -a" lists *all* the processes
running on the system. You don't want to do this on a system with
several thousand processes!

4. If the application requirements specifically call for that
functionality, there are usually better tools available. If not, it's
exposing some system internals to an end user that probably are either
uninteresting or none of their (expletive deleted) business. "ps" is a
command line system administration tool.

5. There are worse versions of the "ps" command than "ps -a". For
example, "ps -vax" or "ps -uax" does a *sort* on all the processes! Take
your system with thousands of processes and sort all those lines every
two seconds? Not on *my* server, please!!