tomcat启动后Docker执行ant脚本? [英] Docker execute ant script after tomcat starts?

查看:35
本文介绍了tomcat启动后Docker执行ant脚本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Dockerfile 适用于 tomcat.tomcat启动后,我必须触发ant脚本.catalina.sh 从单独的 run.sh 文件启动.所以,Dockerfile 有CMD ["/tmp/run.sh"]

Dockerfile works correctly for tomcat. After tomcat starts, I have to trigger ant scripts. catalina.sh is started from a separate run.sh file. So, Dockerfile has CMD ["/tmp/run.sh"]

run.sh 文件有以下几行:

The run.sh file has below lines:

  • catalina.sh 运行
  • 原稿

Tomcat 启动但没有调用 ant 脚本.我还尝试了其他可能性,例如:

Tomcat starts but ant scripts are not called. I also tried other possibilities like:

  • catalina.sh 运行 &&附注

tomcat 启动但没有触发antscripts

tomcat starts but antscripts are not triggered

有没有办法在tomcat启动后自动调用ant脚本?我不想在之后使用 docker exec 运行脚本.

Is there a way that I can call the ant scripts automatically after tomcat starts? I dont want to run the scripts afterwards by using docker exec.

推荐答案

其中一种方式,我能想到的实现功能是

One of the ways, I can think of achieving the functionality is

  • 在catalina.sh之前用nohup命令启动antscripts,
  • 并在 antscript 中添加延迟(使用带有 sleep 命令的包装 shell 脚本).

延迟可以是简单的基于时间的等待,也可以只是观察 tomcat 日志,直到服务器启动完成才开始执行.

The delay can be simple time based wait, or could just watch tomcat logs till server startup is complete to start execution.

这篇关于tomcat启动后Docker执行ant脚本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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