Desktop Launcher to start tomcat

Please post all general support questions for LXDE here.

Desktop Launcher to start tomcat

Postby tanoloco » Tue Mar 27, 2012 4:59 pm

Hello,

I'm experiencing problems in creating a desktop launcher to start tomcat.

I create a .desktop file on my desktop called testing.desktop with
Code: Select all
[Desktop Entry]
Encoding=UTF-8
Type=Application
Name=testing
Name[it_IT]=testing
Exec=lxterminal --command "bash -i '/home/foo/scripts/Tomcat/tomcat-start.sh'"
Comment[it_IT]=


Just for testing purposes tomcat-start.sh only contains:
Code: Select all
#!/bin/bash

/usr/local/tomcat6/bin/startup.sh

ps aux | grep tomcat
read -n 1 -t 60 -p "`echo -e '\nPress any key to exit... '`" exit


Now, if I double click on my testing.desktop launcher a new lxterminal window is opened processing tomcat-start.sh
Using CATALINA_BASE: /usr/local/tomcat6
Using CATALINA_HOME: /usr/local/tomcat6
Using CATALINA_TMPDIR: /usr/local/tomcat6/temp
Using JRE_HOME: /opt/jdk1.6.0_22
foo 3611 0.1 0.4 242660 13536 ? Sl 17:45 0:00 leafpad /home/foo/scripts/Tomcat/tomcat-start.sh
foo 4107 16.0 0.4 250016 12780 ? Sl 17:47 0:00 lxterminal --command bash -i '/home/foo/scripts/Tomcat/tomcat-start.sh'
foo 4109 22.0 0.1 8700 4648 pts/0 Ss+ 17:47 0:00 bash -i /home/foo/scripts/Tomcat/tomcat-start.sh
foo 4174 0.0 0.1 913636 5640 pts/0 Sl+ 17:47 0:00 /opt/jdk1.6.0_22/bin/java -Dsolr.solr.home=/home/foo/solr/solr_config/current/master/ -Dsolr.data.dir=/home/foo/solr/data -Dsolr.solr.home=/home/foo/solr/solr_config/current/master/ -Dsolr.data.dir=/home/foo/solr/data -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Djava.util.logging.config.file=/usr/local/tomcat6/conf/logging.properties -Djava.endorsed.dirs=/usr/local/tomcat6/endorsed -classpath :/usr/local/tomcat6/bin/bootstrap.jar:/usr/local/tomcat6/bin/commons-logging-api.jar -Dcatalina.base=/usr/local/tomcat6 -Dcatalina.home=/usr/local/tomcat6 -Djava.io.tmpdir=/usr/local/tomcat6/temp org.apache.catalina.startup.Bootstrap start
foo 4176 0.0 0.0 4472 772 pts/0 S+ 17:47 0:00 grep --color=auto tomcat

Press any key to exit...


and tomcat is working correctly, but only until I close that lxterminal window!
Then tomcat is shutdown .. if I first close that lxterminal and then I open a fresh one i have
Code: Select all
$ ps aux | grep tomcat
foo      3611  0.0  0.4 242660 13536 ?        Sl   17:45   0:00 leafpad /home/foo/scripts/Tomcat/tomcat-start.sh
foo      4278  0.0  0.0   4476   772 pts/0    S+   17:50   0:00 grep --color=auto tomcat


Otherwise if, staring from zero, I open a lxterminal with ctrl+alt+T and type
Code: Select all
$ ps aux | grep tomcat
foo      3611  0.0  0.4 242660 13536 ?        Sl   17:45   0:00 leafpad /home/foo/scripts/Tomcat/tomcat-start.sh
foo      4278  0.0  0.0   4476   772 pts/0    S+   17:50   0:00 grep --color=auto tomcat


tomcat is always working even if I close this window!
In fact if I close this window and open a new one and type
Code: Select all
$ ps aux | grep tomcat
foo      3611  0.0  0.4 242660 13536 ?        Sl   17:45   0:00 leafpad /home/foo/scripts/Tomcat/tomcat-start.sh
foo      4464 12.1  3.2 948060 100948 ?       Sl   17:52   0:06 /opt/jdk1.6.0_22/bin/java -Dsolr.solr.home=/home/foo/solr/solr_config/current/master/ -Dsolr.data.dir=/home/foo/solr/data -Dsolr.solr.home=/home/foo/solr/solr_config/current/master/ -Dsolr.data.dir=/home/foo/solr/data -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Djava.util.logging.config.file=/usr/local/tomcat6/conf/logging.properties -Djava.endorsed.dirs=/usr/local/tomcat6/endorsed -classpath :/usr/local/tomcat6/bin/bootstrap.jar:/usr/local/tomcat6/bin/commons-logging-api.jar -Dcatalina.base=/usr/local/tomcat6 -Dcatalina.home=/usr/local/tomcat6 -Djava.io.tmpdir=/usr/local/tomcat6/temp org.apache.catalina.startup.Bootstrap start
foo      4559  0.0  0.0   4476   768 pts/0    S+   17:53   0:00 grep --color=auto tomcat


So: why it doesn't work for the desktop launcher too?
I would like the desktop launcher open a lxterminal window, processing tomcat-start.sh (which basically gives just the command /usr/local/tomcat6/bin/startup.sh) and then to have tomcat working when the launching lxterminal window will close.

Any suggestion?
Thanks in advance

PD: of course I tried also with simply Exec=lxterminal --command "/usr/local/tomcat6/bin/startup.sh" and it doesn't work either.
tanoloco
 
Posts: 4
Joined: Tue Mar 27, 2012 3:29 pm

Re: Desktop Launcher to start tomcat

Postby tanoloco » Wed Mar 28, 2012 2:05 pm

Hello,

I just want to share with you for future reference for people searching the same that I solved it .. those interested can have a look here http://superuser.com/questions/405681/background-job-in-bash-is-shutting-down-when-the-firing-window-is-closed-how-to
Is there a way to mark this thread as SOLVED? I'm new to this forum ..

Thanks
tanoloco
 
Posts: 4
Joined: Tue Mar 27, 2012 3:29 pm


Return to General Help

Who is online

Users browsing this forum: Yahoo [Bot] and 1 guest