.desktop launcher files not working

Hi All

Spent many days and looking at multiple forums and still cannot get .desktop files to work properly (either creating them manually or by using the Applications - Main Menu - New Item option). OpenSUSE 13.2 Gnome 3.14.1

I have tried putting the .desktop file in both Home-Desktop and in /usr/share/applications etc and both behave the same. I have altered the contents of the .desktop file many times including or removing sudo, adding sudo sh, su -1, sudo -u root, ./pathname, putting the path in quotes or not etc

[Desktop Entry]
Version=1.0
Name=Tomcat_Start
Exec=sudo sh /usr/local/apps/apache-tomcat-5.5.31/bin/startup.sh
Terminal=true
Type=Application
StartupNotify=true

Adding the icon line etc makes no difference.

I can run this command from any terminal, logged in as any user, and it works properly.
sudo /usr/local/apps/apache-tomcat-5.5.31/bin/startup.sh

I know it is an old version of Tomcat but I require this for the application I am running.

Both the .sh and the .desktop files are executable by any user, but when I click the short-cut icon it prompts for a password and then (once a password has been entered) disappears without starting the .sh and without any messages (the terminal closes so I cannot see what failed and there are no log files to show me). The .sh already contains #!/bin/sh and my JRE_HOME and JAVA_Home are set in setenv.sh (and echo properly).

Any assistance appreciated (if I could force the terminal to stay open that would help).

Regards
Active

You need to start the command in a new thread so add a & at the end of the line

Thanks gogalthorp but I have tried -

sudo /usr/local/apps/apache-tomcat-5.5.31/bin/startup.sh &

sudo /usr/local/apps/apache-tomcat-5.5.31/bin/startup.sh&

sudo ‘/usr/local/apps/apache-tomcat-5.5.31/bin/startup.sh’&

sudo ‘/usr/local/apps/apache-tomcat-5.5.31/bin/startup.sh’ &

I am obviously missing something.

Regards
Active

Hi
Use xdg-su;


Exec=/usr/bin/xdg-su -c /usr/local/apps/apache-tomcat-5.5.31/bin/startup.sh

It will ask for the root password though…

What user are you running tomcat as?

Thanks again, though this produces the same effect as before (after entering the password the window disappears and Tomcat hasn’t started).

Using root for this particular application.

Regards
Active

Hi
So, what does startup.sh contain? Or can the actual /sbin/ binary be started direct?

Hi

I think if there were any issues with startup.sh and shutdown.sh then these commands would not work in terminal -

sudo /usr/local/apps/apache-tomcat-5.5.31/bin/startup.sh
sudo /usr/local/apps/apache-tomcat-5.5.31/bin/shutdown.sh

and (directly in the /usr/local/apps/apache-tomcat-5.5.31/bin folder)

./startup.sh
./shutdown.sh

Regards
Active

On Thu 23 Jul 2015 03:26:02 PM CDT, activenewbie wrote:

Hi

I think if there were any issues with startup.sh and shutdown.sh then
these commands would not work in terminal -

Code:

sudo /usr/local/apps/apache-tomcat-5.5.31/bin/startup.sh

Code:

sudo /usr/local/apps/apache-tomcat-5.5.31/bin/shutdown.sh

and (directly in the /usr/local/apps/apache-tomcat-5.5.31/bin folder)

…/startup.sh
…/shutdown.sh

Regards
Active

Hi,
Without installing it’s hard to see what it’s calling and doing, hence
the request :wink:

I’m leaning towards some sort of environment issue with the desktop
file…

In your home directory bin directory create a file called say
mytomcatstart and make it executable.


#!/usr/bin/sh
cd /usr/local/apps/apache-tomcat-5.5.31/bin && exec ./startup.sh $*

Then create a desktop file pointing at that and see if that helps.

Else might have to look at a systemd service file.


Cheers Malcolm °¿° LFCS, SUSE Knowledge Partner (Linux Counter #276890)
SUSE Linux Enterprise Desktop 12 GNOME 3.10.1 Kernel
3.12.43-52.6-default If you find this post helpful and are logged into
the web interface, please show your appreciation and click on the star
below… Thanks!

Hi Malcolm

I eventually managed to copy 2 desktop files from a system running 11.4 (with the same install paths, applications etc) and both those desktop files failed to run on 13.2.

I also noticed a dangling symbolic link message (to a folder in usr/local/apps) on 13.2 wheras on 11.4 there is no issue with the same link.

There’s somethig very odd with 13.2 but currently I am out of time so had to revert to command lines for the time being (awkward for the end customer but at least this functions).

I will come back if I find time in the future. Thanks again forum members for all your help.

Regards
Active