首页 > Linux操作系统 > Linux操作系统 > 强制关闭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}'
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/30015039/viewspace-1339906/ ,如需转载,请注明出处,否则将追究法律责任。