Monday, September 5, 2011

Killing tomcat when it runs out of memory...

I've been pushing the limits on a large file parsing lately and, more often than not, have had to resort to manually killing the tomcat process. Normally, I'd just do a 'ps aux | grep tomcat' and then kill the process. However, I've grown tired of this and thought it would be more interesting to have a one-liner do it for me.


ps aux | grep tomcat | awk '{print $2}' | xargs kill -9

Yes, there are ways to reduce the amount of data from the original 'ps' command.. but 'ps aux' is aliased on my machine, and I'm don't really care about the extra processing this will incur at this moment... :)

2 comments:

  1. try pkill instead :)

    Btw., having to enter captcha after login in is a little awkward, isn't it?

    ReplyDelete
  2. pkill doesn't come native on OSX. And the login/captcha thing is Google's fault. :)

    ReplyDelete