Never been to DZone Snippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

About this user

l00pek

« Newer Snippets
Older Snippets »
Showing 1-1 of 1 total  RSS 

Killing Tomcat on Linux

   1  
   2  #!/bin/sh
   3  
   4  #args to pass to kill
   5  ARG=$1
   6  
   7  for file in `find /proc -regex /proc/[0-9]+ 2> /dev/null`; do
   8  
   9      # FIXME: this will execute the command but I don't think that grep 
  10      # if `grep org.apache.catalina.startup.Bootstrap $file/cmdline`; then 
  11  
  12      if `grep --silent org.apache.catalina.startup.Bootstrap $file/cmdline 2> /dev/null`; then 
  13  
  14          #get the localname of this process id.
  15          #cat $file/cmdline
  16  
  17          #now go ahead and kill this guy
  18          base=`basename $file`
  19          echo kill $ARG $base
  20          kill $ARG $base
  21  
  22      fi 
  23  
  24  done
« Newer Snippets
Older Snippets »
Showing 1-1 of 1 total  RSS