首页 > 解决方案 > 通过 ansible 报告运行 Tomcat `startup.sh` Tomcat 已启动但未启动

问题描述

这是我的任务

- name: Start the tomcat
  shell: ./startup.sh
  args:
    chdir: /opt/tomcat/bin/
    executable: /bin/bash
  become: yes

这是我运行它时的结果

changed: [172.24.75.19] => {
    "changed": true,
    "cmd": "./startup.sh",
    "delta": "0:00:00.021323",
    "end": "2019-08-08 08:12:40.968951",
    "invocation": {
        "module_args": {
            "_raw_params": "./startup.sh",
            "_uses_shell": true,
            "argv": null,
            "chdir": "/opt/tomcat/bin/",
            "creates": null,
            "executable": "/bin/bash",
            "removes": null,
            "stdin": null,
            "stdin_add_newline": true,
            "strip_empty_ends": true,
            "warn": true
        }
    },
    "rc": 0,
    "start": "2019-08-08 08:12:40.947628",
    "stderr": "",
    "stderr_lines": [],
    "stdout": "Using CATALINA_BASE:   /opt/tomcat\nUsing CATALINA_HOME:   /opt/tomcat\nUsing CATALINA_TMPDIR: /opt/tomcat/temp\nUsing JRE_HOME:        /opt/java\nUsing CLASSPATH:       /opt/tomcat/bin/bootstrap.jar:/opt/tomcat/bin/tomcat-juli.jar\nTomcat started.",
    "stdout_lines": [
        "Using CATALINA_BASE:   /opt/tomcat",
        "Using CATALINA_HOME:   /opt/tomcat",
        "Using CATALINA_TMPDIR: /opt/tomcat/temp",
        "Using JRE_HOME:        /opt/java",
        "Using CLASSPATH:       /opt/tomcat/bin/bootstrap.jar:/opt/tomcat/bin/tomcat-juli.jar",
        "Tomcat started."

同时Tomcat没有在服务器上启动。

标签: ansible

解决方案


可能是你需要添加 nohup 然后它可能是工作

  • name: 启动tomcat shell: nohup /path/startup.sh args: chdir: /opt/tomcat/bin/ 可执行文件: /bin/bash become: yes

推荐阅读