{{{ pid=$(ps axw -eo pid,command | grep "org.apache.catalina.startup.Bootstrap" | grep "start" | awk '{print $1}') if [ -z "$pid" ]; then echo "tomcat is not running" else echo "tomcat is detected and the pid is $pid" kill -9 $pid if [ -z $? ];then echo " tomcat ($pid) is killed ..." else echo "kill error ..." fi fi }}}