Waiting for a process to die
Steven Schlansker
scs at eecs.berkeley.edu
Sun May 31 19:46:59 UTC 2009
Chris Rees wrote:
> [ `ps ax |grep pid | wc -l ` = 1 ] && (echo "done!" | Mail -s "PROC
> DONE" kelly.terry.jones at gmail.com)
>
Not always going to work. For example,
[steven at 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 at scs:~]% ps ax | grep 1 | wc -l
94
More information about the freebsd-questions
mailing list