强制关闭tomcat sh脚本

shutdown-force.sh解决tomcat无法正常关闭需要手动kill问题。
把shutdown-force.sh放到tomcat/bin目录下,强制关闭tomcat:

cd tomcat/bin
./shutdown-force.sh


sh脚本内容:

set fileformat=unix
#!/bin/bash
#by lym6520 2014-11-08
#force shutdown tomcat,copy this sh file to tomcat/bin dir

path=${PWD}

ps -ef|grep $path|grep java|awk '{print $2}'

echo "exec $path/shutdown.sh"
$path/shutdown.sh

sleep 3s

#kill -9 pid
ps -ef|grep $path|grep java|awk '{print $2}'|xargs kill -9

#success msg
echo "shutdown success"

ps -ef|grep $path|grep java|awk '{print $2}'

你可能感兴趣的:(linux)