[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Sheflug] Little script help
I think that you have to iterate through each numbered directory
in /proc and parse /proc/<pid>/cmdline. I'm not 100% sure of its
syntax though. At first glance, it doesn't seem to like putting
blankspace between the command name and its commandline arguments.
I'm sure there's probably some non-printable character in there,
probably '\0' ;)
I don't think that the kernel gives you an interface to a nicely
formatted list of the processes.
A.D.
On Mon, Nov 27, 2000 at 03:26:07PM +0000, José Luis Gómez Dans wrote:
> Hi Alastair,
>
> On Mon, Nov 27, 2000 at 03:07:41PM +0000, Alastair Donlon wrote:
>
> > A really dirty command line would look like:
> >
> > ps -A e | grep 'cat /tmp/' | awk 'print $6' | sed -e 's/\/tmp\///'
> >
>
> That's what I had thought of, but in this case, ps _is_ a
> script itself, that runs on mawk (mulinux's very own awk
> implementation). Bearing this in mind, the machine this script needs to
> run on takes something like 45-50 seconds to list all current processes
> (no joke), plus the grep, sed and friends, the count rises and rises and
> rises... That's why I had this idea of using a little script in
> /proc/somewhere directly to cut the out middle man. The thing is that I
> can't quite remember where the list of processes resides (if at all, I
> know that a list of all processes exists at /proc/process_id), and I
> wasn't too sure of its syntax (and of the syntax needed to sed/awk it).
>
> Thanks,
> José
> --
> José L Gómez Dans PhD student
> Tel: +44 114 222 5582 Radar & Communications Group
> FAX; +44 870 132 2990 Department of Electronic Engineering
> University of Sheffield UK
> ---------------------------------------------------------------------
> Sheffield Linux User's Group - http://www.sheflug.co.uk
> To unsubscribe from this list send mail to
> - <sheflug-request [at] vuw.ac.nz> - with the word
> "unsubscribe" in the body of the message.
>
> GNU the choice of a complete generation.
>
>
---------------------------------------------------------------------
Sheffield Linux User's Group - http://www.sheflug.co.uk
To unsubscribe from this list send mail to
- <sheflug-request [at] vuw.ac.nz> - with the word
"unsubscribe" in the body of the message.
GNU the choice of a complete generation.