等到tomcat完成启动 [英] Wait until tomcat finishes starting up

查看:60
本文介绍了等到tomcat完成启动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个脚本,需要在tomcat完成启动并准备开始部署应用程序之后运行.我正在使用$TOMCAT_HOME/bin/startup.sh,它会立即返回.我怎样才能等到tomcat完成启动?

I have a script that needs to run after tomcat has finished starting up and is ready to start deploying applications. I'm using $TOMCAT_HOME/bin/startup.sh which returns immediately. How can I wait until tomcat has finished starting up?

推荐答案

大概有几种方法可以做到这一点.我们使用的技巧是:

There are probably several ways to do this. The trick we use is:

#!/bin/bash

until [ "`curl --silent --show-error --connect-timeout 1 -I http://localhost:8080 | grep 'Coyote'`" != "" ];
do
  echo --- sleeping for 10 seconds
  sleep 10
done

echo Tomcat is ready!

希望这会有所帮助!

这篇关于等到tomcat完成启动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆