On Thu, Oct 30, 2008 at 12:18 PM, Oliver Fromme <[EMAIL PROTECTED]> wrote:
> Eduardo Meyer wrote:
>  > I need to write a cgi script which will print the output from ps(1) in
>  > a table (html), so the average-operator can click on a KILL link and

Thank you all. I didnt mention the language, yes, I wanted it with
shell script. Sadly, no idea was completly enough, for the default ps
output it simple has no pattern. No multiple-pattern would do the job
safely. With kernel stuff like idle, output happens to be completly
nonsense. Counting positions in a array is the way to go, but not with
the default output. Things just happen to get completly trashed with
long values, like idle CPU time.

What I did was formating every output header like that

ps -o start="<<<..............................................>>>" -o
lstart="<<<..............................................>>>"  -o
args="<<<..............................................>>>"  etc

So I could find the begining and the ending column. "-o command"  or
"-o args" have always to be the last option, if I dont want 'em to get
truncated.

So sad.

Now my next problem, do the sabe with sockstat....

%sockstat | head -4
USER     COMMAND    PID   FD PROTO  LOCAL ADDRESS         FOREIGN ADDRESS
freebsdsupportsshd   57255 3  tcp4   172.16.0.225:22       172.16.0.69:63583
freebsdsupportsshd   57255 4  stream -> ??
root     sshd       57253 3  tcp4   172.16.0.225:22       172.16.0.69:63583

So I have the USER and COMMAND column "merged" in a single string,
because username is large. Again, space can not be used as a
separator, but hopefully only the patterns with "->" will have space
if not a column separator, easier to parse.

But sockstat have no formatting option to be issued like -o from
ps(1). Measing in the very first sockstat output, I dont know what to
do... :(



-- 
===========
Eduardo Meyer
pessoal: [EMAIL PROTECTED]
profissional: [EMAIL PROTECTED]
_______________________________________________
freebsd-stable@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-stable
To unsubscribe, send any mail to "[EMAIL PROTECTED]"

Reply via email to