Kill tomcat by spec dir
#!/bin/sh #kill tomcat pid pidlist=`ps -ef|grep tomcat_foobar/conf | grep -v "grep"|awk '{print $2}'` echo "tomcat Id list :$pidlist" if [ "$pidlist" = "" ] then echo "no tomcat pid alive" else for pid in ${pidlist} { kill -9 $pid echo "KILL $pid:" echo "service stop success" } fi