Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 31 May 2009 12:42:37 -0700
From:      Steven Schlansker <scs@eecs.berkeley.edu>
To:        utisoft@gmail.com
Cc:        Kelly Jones <kelly.terry.jones@gmail.com>, freebsd-questions@freebsd.org
Subject:   Re: Waiting for a process to die
Message-ID:  <4A22DDAD.8070504@eecs.berkeley.edu>
In-Reply-To: <b79ecaef0905311128v2e1921a8p30c6ead961759780@mail.gmail.com>
References:  <26face530905311117te38a4faya92733fbfebd9597@mail.gmail.com> <b79ecaef0905311128v2e1921a8p30c6ead961759780@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
Chris Rees wrote:
> [ `ps ax |grep pid | wc -l ` = 1 ] && (echo "done!" | Mail -s "PROC
> DONE" kelly.terry.jones@gmail.com)
>   

Not always going to work.  For example,

[steven@scs:~]% ps ax | grep init
    1 ?        Ss     0:39 init [2] 
13421 pts/1    R+     0:00 grep init

Also if you use its pid, 1, you get a whole bunch of uninteresting 
processes as you're grepping for "1" ;)

[steven@scs:~]% ps ax | grep 1 | wc -l
94




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4A22DDAD.8070504>