/ Published in: Bash
Thanks to Kastner for these snippets.
Expand |
Embed | Plain Text
# for one proc ps ax | grep 'java -jar start.jar' | grep -v 'grep' | cut -f 2 -d " " | xargs kill -9 # when you don't want the output, and don't want to return nonzero # in the event the process isn't running # useful, eg when running inside of a Hudson build step ps ax | grep 'java -jar start.jar' | grep -v 'grep' | cut -f 1 -d " " | perl -ne 'qx{kill -9 $_} if $_' # for many procs for i in Xvfb selenium sprouter pgproxy mockservers; do ps ax | grep $i | grep -v grep | cut -f 1 -d " " | xargs kill -9 ; done
You need to login to post a comment.
