Script-friendly (parseble) ps(1) output?
Mel
fbsd.questions at rachie.is-a-geek.net
Thu Oct 30 07:14:16 PDT 2008
On Wednesday 29 October 2008 23:02:43 Eduardo Meyer wrote:
> ps -ax -o pid -o user -o emul -o lstart -o lockname -o stat -o command
First of all you will want -ww, since the command will otherwise be truncated.
Secondly, you can comma seperate the -o arguments for brevity, so:
ps -awwx -o pid,user,emul,lstart,lockname,stat,command
will be your command.
You forgot to mention what language your CGI will be in, so I'll just give you
the simplest algorithm:
- read the first line
- record position of the first character after a space character, by simply
walking the line char by char
- Using those positional numbers it is now trivial to extract the information
from the rest of the lines.
--
Mel
Problem with today's modular software: they start with the modules
and never get to the software part.
More information about the freebsd-questions
mailing list