如何在 Ansible 上运行 tomcat catalina 脚本 [英] How to run tomcat catalina script on Ansible

查看:36
本文介绍了如何在 Ansible 上运行 tomcat catalina 脚本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试为 tomcat 应用程序部署设置 Ansible playbook.除了启动 tomcat 之外,一切正常.当我使用 startup.sh 时它可以工作,但我需要使用 catalina.sh 脚本启动 tomcat.

I am trying to setup Ansible playbook for tomcat application deployment. Apart from starting tomcat everything works without any issues. When i use startup.sh it works but i need to start tomcat with catalina.sh script.

   - name: start tomcat
     command: ./bin/catalina.sh start
     args:
       chdir: /websrv/tomcat/tomcat-8080/

这就是我想要做的,它说已开始但从未开始.

This is what i am trying to do, it says started but it was never started.

TASK [start tomcat] ************************************************************
changed: [appserver.example.com]

请帮忙.

注意:我在centos上使用的是压缩版的tomcat,还没有安装tomcat.因此,如果有人阐明如何启动脚本,那将非常有帮助.

Note: I am using zipped version of tomcat on centos and have not installed tomcat. So if anyone shed light on how to start the script it would be really helpful.

推荐答案

内置的 Tomcat 管理脚本不会与 tty 分离,这会导致它们在 Ansible ssh 会话结束时被终止.您需要修改脚本以使其成为后台/分离,或者为 Tomcat 编写并安装适当的 init/systemd 脚本(或来自众多示例中的任何一个).例如,这里此处这里...

The built-in Tomcat management scripts don't detach from the tty, which causes them to be killed when the Ansible ssh session ends. You need to either hack the script to cause it to be backgrounded/detached, or write and install a proper init/systemd script (or crib from any of the numerous examples out there) for Tomcat. For example, here or here or here...

这篇关于如何在 Ansible 上运行 tomcat catalina 脚本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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