shell脚本
#! /bin/bash
SHUTDOWN="/root/tomcat/bin/shutdown.sh"
STARTTOMCAT="/root/tomcat/bin/startup.sh"
echo "关闭tomcat"
$SHUTDOWN
ps -ef |grep tomcat |grep /root/platform |grep -v 'grep'|awk '{print $2}' | xargs kill -9
sleep 10
echo "启动tomcat"
$STARTTOMCAT
注:先使用tomcat本身的shutdown命令关闭,再用杀进程的方式补偿,做到真正关闭tomcat
注2:awk '{print $2}'的含义是取前面查询结果的第二个分段
欢迎光临娇娇家的美衣阁 http://shop105984718.taobao.com/