echo "查询所有tomcat并停止" pid=`ps -ef|grep $APP_NAME|grep -v grep|awk '{print $2}'` if [ "${pid}" ]; then for id in $pid do kill -9 $id done fi echo "进程已停止"
echo "[info][$(date)]准备启动tomcat" $binPath"/startup.sh" if [ $? -eq 0 ]; then echo "启动命令执行成功........" echo "检查tomcat运行状态..." for (( i=0; i<12; ++i )) do if [ $(curl -sIL -w "%{http_code}" -o /dev/null http://localhost:8080/login.html) -eq 200 ];then echo "tomcat启动成功" break else if [[ i -eq 11 ]];then echo "tomcat启动失败,请查看tomcat日志" exit 1 else echo "tomcat正在启动中..." sleep 5 fi fi done else echo "启动命令执行失败......." fi