编写bash脚本快速kill或启动tomcat
假设tomcat安装路径为 /home/tomcat,示例如下:
1. kill tomcat进程
vim kill-tomcat-force.sh
set fileformat=unix
path=/home/tomcat/bin
echo"exec $path/shutdown.sh"
$path/shutdown.sh
sleep3s
#kill -9 pid
ps -ef|grep $path|grep tomcat|awk '{print $2}'|xargs kill-9
#success msg
echo "shutdown success"
2. start tomcat
vim startTomcat.sh
echo 'start tomcat'
/home/tomcat/bin/startup.sh
sleep 3s
3. 查tomcat日志
vim showLog.sh
tail -f /home/tomcat/logs/catalina.out
喜欢请赞赏一下啦^_^