1

I'm using Ubuntu 14.04 LTS on a virtual machine and I'm trying to set it up so that when it starts up it also automatically follow the description on the startmeup.sh.desktop to start the script taskhome.sh.

The startmeup.sh.desktop script has the following code:

[Desktop Entry]
Type=Application
Exec=/home/kvm/scripts/taskhome.sh
Hidden=false
NoDisplay=false
X-GNOME-Autostart-enabled=true
Name[en]=Startmeup
Name=Startmeup
Comment[en]=
Comment=

I put the file startmeup.sh.desktop on the folder config\autostart and I made it executable with the chmod +x command, but when I reboot Ubuntu the script taskhome.sh is not executed (I guess it's just because the startmeup.sh.desktop is simply not executed either).

If I launch the taskhome.sh script manually I don't have any problem. If I open the folder that contains the script startmeup.sh.desktop, and I double click on it, the taskhome.sh script starts without any problem.

However if I try to execute the startmeup.sh.desktop script on a terminal with the command ./startmeup.sh.desktop then I get the error "

line 1: [Desktop: command not found.

Is there something I can do to make the script work on Ubuntu start up?

Braiam
  • 67,791
  • 32
  • 179
  • 269
Marest
  • 19
  • Running the .desktop file itself in a terminal doesn't work (even if it's executable). What's the script supposed to do? It's not set to run in a terminal, so could be running already & you don't see it. – Xen2050 Dec 30 '14 at 14:50
  • @Marest Copy your .desktop file to cp /path/to/startmeup.sh.desktop ~/.config/autostart/ and then try chmod +x ~/.config/autostart/startmeup.sh.desktop. will work. – αғsнιη Dec 30 '14 at 15:03
  • 1
    @KasiyA why making a .desktop file executable? .desktop files are configuration files, not "scripts", so making it executable is just a wast of time (and a potential security issue). – Braiam Dec 30 '14 at 19:11
  • @Braiam Yes, you are right. – αғsнιη Dec 31 '14 at 06:39
  • In Thunar (XFCE) executing a .desktop file without it being executable (even in ~/.config/autostart) says "Untrusted application launcher - The desktop file "xxx.desktop" is in an insecure location and not marked as executable. If you do not trust this program, click Cancel." Making it executable then shows it's name using the "Name=" tag, and not it's filename. – Xen2050 Jan 01 '15 at 18:21
  • FYI to anyone else reading, @Marest replied with an "Answer" saying they had the script in the wrong folder. (If they come back they could select an answer) – Xen2050 Jan 01 '15 at 18:51

3 Answers3

3

Running ./startmeup.sh.desktop from the terminal will not work, as the .desktop is not a shell script.

Also add:

Terminal=true

that might be of help!

To start application on startup, you need to do it the usual way:

blade19899
  • 26,704
2

Wait a minute, what folder did you put the script in? Your Q says config\autostart... it's supposed to be in ~/.config/autostart (in your home folder) and should run when the user logs in, not only on bootup (unless that user is automatically logged in too)

You don't have an Icon=... line, but that might not bake a big difference.

And what's the script supposed to do? It's not set to run in a terminal (Terminal=true might do that) so how do you know it's not running in the background?

Xen2050
  • 8,705
0

Try changing the "Exec=" mode with this one:

Exec=gnome-terminal -x /home/kvm/scripts/taskhome.sh

Manpage for -x:

-x, --execute
Execute the remainder of the command line inside the terminal.

Should be like:

[Desktop Entry]
Type=Application
Exec=gnome-terminal -x /home/kvm/scripts/taskhome.sh
Hidden=false
NoDisplay=false
X-GNOME-Autostart-enabled=true
Name[en]=Startmeup
Name=Startmeup
blkpws
  • 1,212