natxo
Posts: 29
Joined: Mon Sep 18, 2017 3:47 pm

i want to launch an app after the system has booted to desktop.

Sat Nov 11, 2017 12:04 pm

Hello

i want to launch an app after the system has booted to desktop

I think that in the system.d script i can choose when the app its launched setting the after parameter

Code: Select all

[Unit]
Description=My App
After=??????
But i don't know what i have to put on after to get the app launched after the pi load the desktop.

Also there is a link where i can see the explain on those system.d parameters ???

Thanks

klricks
Posts: 6618
Joined: Sat Jan 12, 2013 3:01 am
Location: Grants Pass, OR, USA
Contact: Website

Re: i want to launch an app after the system has booted to desktop.

Sat Nov 11, 2017 4:04 pm

Use autostart instead of system.d

Code: Select all

nano /home/pi/.config/lxsession/LXDE-pi/autostart
Your entry in autostart should be like this:

Code: Select all

@lxterminal -e path_to_my_app/my_app
Note that when the script returns back to the CL then the lxterminal will immediately close.

If your splash screen still says Pixel then you haven't updated in a long while.
Unless specified otherwise my response is based on the latest and fully updated Raspbian Buster w/ Desktop OS.

natxo
Posts: 29
Joined: Mon Sep 18, 2017 3:47 pm

Re: i want to launch an app after the system has booted to desktop.

Sat Nov 11, 2017 4:28 pm

klricks wrote:
Sat Nov 11, 2017 4:04 pm
Use autostart instead of system.d

Code: Select all

nano /home/pi/.config/lxsession/LXDE-pi/autostart
Your entry in autostart should be like this:

Code: Select all

@lxterminal -e path_to_my_app/my_app
Note that when the script returns back to the CL then the lxterminal will immediately close.

If your splash screen still says Pixel then you haven't updated in a long while.
Yes i have not updated for a time, its because the c++ framework im using does not compile on stretch so im still an older version.

Can you please elaborate this, i don't understand:
Note that when the script returns back to the CL then the lxterminal will immediately close.
Thanks!

natxo
Posts: 29
Joined: Mon Sep 18, 2017 3:47 pm

Re: i want to launch an app after the system has booted to desktop.

Sat Nov 11, 2017 4:46 pm

ok, now i understand what you are saying :)

I was reading https://wiki.archlinux.org/index.php/LXDE#Autostart and says:
If a line starts with @, and the command following it crashes, the command is automatically re-executed
Does it means that if my apps crash i will be launched again?? can this be disabled?

klricks
Posts: 6618
Joined: Sat Jan 12, 2013 3:01 am
Location: Grants Pass, OR, USA
Contact: Website

Re: i want to launch an app after the system has booted to desktop.

Sat Nov 11, 2017 5:12 pm

natxo wrote:
Sat Nov 11, 2017 4:28 pm
......
Can you please elaborate this, i don't understand:
Note that when the script returns back to the CL then the lxterminal will immediately close.
Thanks!
The lxterminal opened by the @lxterminal -e in autostart will immediately close when your script exits and returns to the cl.
So if your script outputs messages to the console for example: "Hello World", and then exits without delay, then you will not see the message.
The terminal will open and the script will run but the terminal session will close before you can see it.

This may or may not be an issue depending on what type of App you are wanting to run.

For example a standard app such as the File Manager can be started at desktop boot with no issues:

Code: Select all

@lxterminal -e pcmanfm
Unless specified otherwise my response is based on the latest and fully updated Raspbian Buster w/ Desktop OS.

klricks
Posts: 6618
Joined: Sat Jan 12, 2013 3:01 am
Location: Grants Pass, OR, USA
Contact: Website

Re: i want to launch an app after the system has booted to desktop.

Sat Nov 11, 2017 5:25 pm

natxo wrote:
Sat Nov 11, 2017 4:46 pm
ok, now i understand what you are saying :)

I was reading https://wiki.archlinux.org/index.php/LXDE#Autostart and says:
If a line starts with @, and the command following it crashes, the command is automatically re-executed
Does it means that if my apps crash i will be launched again?? can this be disabled?
Don't know.... Just omit the @ and see.
Unless specified otherwise my response is based on the latest and fully updated Raspbian Buster w/ Desktop OS.

Return to “Beginners”