Start Tomcat remotely using Fabric

I am having a problem with Tomcat 7 and fabric. I can stop tomcat remotely. Unfortunately, I cannot run it using python-fabric. This gives me a way out and no sign of error, but still tomcat does not start. This is my command:

@task
def start_tomcat():
    sudo('/opt/tomcat/bin/startup.sh')

Ouput:

[bw.node1] Executing task 'start_tomcat'
Starting Tomcat
[bw.node1] run: echo $JAVA_HOME
[bw.node1] out: /usr/lib/jvm/java-1.6.0
[bw.node1] out: 

[bw.node1] sudo: ./startup.sh
[bw.node1] out: sudo password:
[bw.node1] out: Using CATALINA_BASE:   /opt/tomcat
[bw.node1] out: Using CATALINA_HOME:   /opt/tomcat
[bw.node1] out: Using CATALINA_TMPDIR: /opt/tomcat/temp
[bw.node1] out: Using JRE_HOME:        /usr/lib/jvm/java-1.6.0
[bw.node1] out: Using CLASSPATH:       /opt/tomcat/bin/bootstrap.jar:/opt/tomcat/bin/tomcat-juli.jar
[bw.node1] out: 


Done.
Disconnecting from bw.node1... done.

And still nothing happens. I also checked catalina.out and tomcat does not start.

+4
source share
1 answer

Finally, I was able to figure out how to run tomcat remotely using a fabric.

The problem was in the background tasks, as they will be killed when the team ends.

The solution is simple: just add "set -m;" prefix before the team. A full cloth team should be:

sudo('set -m; /opt/tomcat/bin/startup.sh')

+10

Source: https://habr.com/ru/post/1544099/


All Articles