tomcat启动后Docker执行ant脚本吗? [英] Docker execute ant script after tomcat starts?
问题描述
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运行
- antscript
Tomcat启动,但不调用ant脚本.我还尝试了其他可能性,例如:
Tomcat starts but ant scripts are not called. I also tried other possibilities like:
- catalina.sh运行&&上标
tomcat启动,但脚本未触发
tomcat starts but antscripts are not triggered
有没有一种方法可以在tomcat启动后自动调用蚂蚁脚本?我不想以后再使用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命令开始抄本,
- 并在上标中添加延迟(使用带有睡眠命令的包装外壳脚本).
该延迟可以是基于时间的简单等待,也可以只是监视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屋!