On Sun, May 31, 2009 at 12:42:37PM -0700, Steven Schlansker wrote: > > Chris Rees wrote: > >[ `ps ax |grep pid | wc -l ` = 1 ] && (echo "done!" | Mail -s "PROC > >DONE" kelly.terry.jo...@gmail.com) > > > > Not always going to work. For example, > > [ste...@scs:~]% ps ax | grep init > 1 ? Ss 0:39 init [2] > 13421 pts/1 R+ 0:00 grep init
This is why you should use pgrep(1) to find a PID (and kill it) rather than directly grepping a ps output like the previous poster did. > > Also if you use its pid, 1, you get a whole bunch of uninteresting > processes as you're grepping for "1" ;) > > [ste...@scs:~]% ps ax | grep 1 | wc -l > 94 > Wojcech nailed the approach the OP should be using. Regards, -- Frank Contact info: http://www.shute.org.uk/misc/contact.html _______________________________________________ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"