Re: Gack, this shouldn't happen under a stable OS I think

Olaf Titz (olaf@bigred.inka.de)
24 Sep 1996 12:13:23 +0200


Chris Fearnley <cjf@netaxs.com> wrote:
> root@syntropy # ps aux|grep 27231
> root 27231 0.0 2.1 828 324 p7 S 23:28 0:00 /usr/sbin/radiusd
> root@syntropy # ps aux|grep 27231
> root 27231 0.0 2.1 828 324 p7 S 23:28 0:00 /usr/sbin/radiusd
> root 27239 0.0 2.5 916 376 p7 S 23:28 0:00 grep 27231
> Why doesn't the grep process show up each time???

Race condition between ps and grep (which one of them is finished
faster and in which order does ps output come up). At least newer
versions of procps support a pid argument to ps, so you can do
ps -aux 27231.

If you really need grep on a ps listing, e.g. to find processes of a
certain program, the standard way to do this is grepping out the grep:
ps -aux | grep "httpd" | grep -v grep
Not beautiful; direct supprt for this would surely be a nice extension to ps.

olaf

-- 
___        Olaf.Titz@inka.de or @{stud,informatik}.uni-karlsruhe.de       ____
__ o           <URL:http://www.inka.de/~bigred/>     <IRC:praetorius>
__/<_              >> Just as long as the wheels keep on turning round
_)>(_)______________ I will live for the groove 'til the sun goes down << ____