Tomcat turn off directly after startup when called using gksu

798 Views Asked by At

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 ?

1

There are 1 best solutions below

0
On

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.