Killing Tomcat on Linux
#!/bin/sh #args to pass to kill ARG=$1 for file in `find /proc -regex /proc/[0-9]+ 2> /dev/null`; do # FIXME: this will execute the command but I don't think that grep # if `grep org.apache.catalina.startup.Bootstrap $file/cmdline`; then if `grep --silent org.apache.catalina.startup.Bootstrap $file/cmdline 2> /dev/null`; then #get the localname of this process id. #cat $file/cmdline #now go ahead and kill this guy base=`basename $file` echo kill $ARG $base kill $ARG $base fi done