Page 1 of 1

Execute two commands sequentially in autostart desktop file

Posted: Tue Aug 18, 2009 3:39 pm
by modest
I am using LXDE on my Debian 5.0 system. I am trying to auto-execute the following two commands sequentially:

Code: Select all

less /root/README.TXT  #(Basically a README file)
and then

Code: Select all

./root/install.sh #(a shell script)
So I created a auto.desktop file in ~/config/autostart directory whose contents are:

Code: Select all

[Desktop Entry]
Encoding=UTF-8
Name=AutoStart
Comment=README and Script
#Exec=xterm -e less '/root/README.TXT' && xterm -e '/root/install.sh'
Exec=lxterminal --command "less /root/README.TXT" && lxterminal --command "/root/install.sh"
Terminal=true
Now I have tried both the "Exec" command above and none of them worked for me. For the first one Exec (the one commented) only the first command (README) gets executed. For the second command, only the later (install.sh) command gets executed.

How do I make two files launched sequentially (the second one - install.sh) executed only after user closes the first one - README.TXT).

Re: Execute two commands sequentially in autostart desktop file

Posted: Tue Aug 18, 2009 6:18 pm
by maces
Hi

I would write a third script which launches the first one and then the second one:

Code: Select all

#!/bin/bash
# run_install.sh
less /root/README.TXT
/root/install.sh
exit 0
The desktop file :

Code: Select all

[Desktop Entry]
Encoding=UTF-8
Name=AutoStart
Comment=README and Script
Exec=lxterminal --command "run_install.sh"
Terminal=true

Re: Execute two commands sequentially in autostart desktop file

Posted: Tue Aug 18, 2009 7:36 pm
by modest
Hi Maces,

I already did that just in case if there is no way to do this with just one command line.

I guess I will have to go with that route since it looks like it is not possible.

I was just trying to avoid managing one more file (even thought it is a simple file).

Thank you for the reply, though.

Re: Execute two commands sequentially in autostart desktop file

Posted: Wed Aug 19, 2009 3:14 am
by PCMan
modest wrote:Hi Maces,
I already did that just in case if there is no way to do this with just one command line.
I guess I will have to go with that route since it looks like it is not possible.
I was just trying to avoid managing one more file (even thought it is a simple file).
Thank you for the reply, though.
Try this:

Code: Select all

Exec=sh 'cmd1 && cmd2'
Maybe this works?