0

I'm trying to use a launcher within the gnome menu in order to start a Tomcat server. For that I used the following command "gksu sh /myhome/tomcat_starter". The script "tomcat_starter" defines some environment variables before it starts the server:

#!/bin/bash

JAVA_HOME="/myhome/java" 
export JAVA_HOME
PATH=$PATH:$JAVA_HOME/bin
export PATH

CATALINA_HOME="/myhome/tomcat"
export CATALINA_HOME

$CATALINA_HOME/bin/startup.sh

When the launcher started, it asks for the su password as expected and also started the tomcat server. But the server turns off directly after the start.

Here is a cuttout from the log file

INFO: Deploying web application directory docs
Oct 01, 2012 11:28:06 AM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory ROOT
Oct 01, 2012 11:28:06 AM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["http-bio-80"]
Oct 01, 2012 11:28:06 AM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["ajp-bio-8009"]
Oct 01, 2012 11:28:06 AM org.apache.catalina.startup.Catalina start
INFO: Server startup in 1085 ms
Oct 01, 2012 11:28:08 AM org.apache.coyote.AbstractProtocol pause
INFO: Pausing ProtocolHandler ["http-bio-80"]
Oct 01, 2012 11:28:09 AM org.apache.coyote.AbstractProtocol pause
INFO: Pausing ProtocolHandler ["ajp-bio-8009"]
Oct 01, 2012 11:28:10 AM org.apache.catalina.core.StandardService stopInternal
INFO: Stopping service Catalina
Oct 01, 2012 11:28:10 AM org.apache.coyote.AbstractProtocol stop
INFO: Stopping ProtocolHandler ["http-bio-80"]
Oct 01, 2012 11:28:10 AM org.apache.coyote.AbstractProtocol stop
INFO: Stopping ProtocolHandler ["ajp-bio-8009"]
Oct 01, 2012 11:28:10 AM org.apache.coyote.AbstractProtocol destroy
INFO: Destroying ProtocolHandler ["http-bio-80"]
Oct 01, 2012 11:28:10 AM org.apache.coyote.AbstractProtocol destroy
INFO: Destroying ProtocolHandler ["ajp-bio-8009"]<code>

Does someone has an idea why the tomcat server turns off ?

Sabbane
  • 2,938
  • 4
  • 21
  • 27
  • I find out that the cause is closing the terminal. When I add a sleep command within my script, the server lives as long as this time elapsed. After that the terminal closed and the server too. Is there a way to prevent this behaviour ? – Sabbane Oct 01 '12 at 16:00

1 Answers1

0

I find out that by using the command "nohup" the server will remain running in the background. So the launcher command is now "nohup gksu sh /myhome/tomcat_starter" and it works well.

Sabbane
  • 2,938
  • 4
  • 21
  • 27