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
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
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!!