1

When I run my start command via ssh it tells me that its started but it is in fact not the case. Catalina logs does not seem to capture any events either. However stop and status works.

ssh -t SERVER1 'sudo /etc/init.d/tomcat7 start'
Starting tomcat
Using CATALINA_BASE:   /opt/tomcat
Using CATALINA_HOME:   /opt/tomcat
Using CATALINA_TMPDIR: /opt/tomcat/temp
Using JRE_HOME:        /usr/java/default
Using CLASSPATH:       /opt/tomcat/bin/bootstrap.jar:/opt/tomcat/bin/tomcat-juli.jar
Tomcat started.

When I run the command locally on the SERVER1 it starts successfully.

I'm a bit baffled by this behaviour. Any idea what the root cause might be?

kaizenCoder
  • 343
  • 2
  • 8
  • 22

1 Answers1

2

So this turned out to be an issue when tty was enabled via the ssh -t option. The tomcat process only remained active as long as the tty session was active. I had modify the start up script by prefixing the start up command with nohup which fixed the issue.

nohup - run a command immune to hangups, with output to a non-tty

kaizenCoder
  • 343
  • 2
  • 8
  • 22
  • I don't understand.... what's is the new new solution? – Geddon Mar 09 '16 at 19:35
  • @Geddon - This might be a bit late, but just fyi, the answer involved using the `USE_NOHUP` catalina variable in order to spawn the java process to start tomcat in a way that it does not get interrupted when the ssh command finishes the execution – Tewfik Ghariani Apr 17 '22 at 16:12