cancel
Showing results for 
Search instead for 
Did you mean: 

How to add program to autostart?

La1
Associate III

Hi, how to add program to autostart in OpenSTLinux ?

I tried adding initialization script to /etc/init.d and creating .desktop file in ~/.config/autostart directory, but nothing works.

I will be very gratefull, if somebody could help me.

1 ACCEPTED SOLUTION

Accepted Solutions
La1
Associate III

I found much easier solution to add graphical app to autostart on STM32MP157c-dk2:

1.Create start script in /usr/local/weston-start-at-startup directory with execution permissions.

Example script:

/home/root/app <- this is the proper graphical application

2. Optionally disable the current start_up_demo_launcher.sh by removing it's execution permisions.

I was looking for answer like that, that's shame that nobody propose this soloution earlier : /

View solution in original post

8 REPLIES 8
Fee
Senior

OpenSTLinux is using systemd as the init process. You can have a look at how to write a systemd service. This service then can execute a script or program.

La1
Associate III

Hi, thanks for answer. I am trying to use this, but can't make it work. Maybe it is because i am trying to run graphical application ?

On Ubuntu creating .desktop file in ~/.config/autostart directory works well.

Fee
Senior

Hi, I am not using a graphical interface so I can't help you there. Maybe you have to execute your systemd service after weston has started (using the After=<systemd service> property). I hope someone else can help you with your problem :)

mleo
Senior II

Hi,

place your script with execute permission into /etc/init.d direcotory and enable it by update-rc.d command.

BR,

Milan

rzr www.rzr.online.fr
Associate II

Why not creating systemd's services files and use systemctl to enable them ?

--

http://purl.org/rzr

mleo
Senior II

You are right, ​I consulted - systemd is preferred on ST distribution. 

Milan

La1
Associate III

Ok, i got the answer:

To add graphical app to autostart on STM32MP157c-dk2, you need to create systemd service with Weston Environment variables set properly and with properly set "After" statement in service.

Here is my startapp.service:

[Unit]

Description=Start app at startup

After=display-manager.service

[Service]

ExecStart=/etc/systemd/system/startapp.sh

[Install]

WantedBy=multi-user.target

Here is my startapp.sh script:

#!/bin/bash

. /etc/profile.d/weston_profile.sh

/home/root/app #this is the proper graphical application

Sourcing weston_profile.sh script sets all needed weston environment variables. Then you need to enable your service, by typing "systemctl enable startapp.service"

Hope it helps somebody :)

La1
Associate III

I found much easier solution to add graphical app to autostart on STM32MP157c-dk2:

1.Create start script in /usr/local/weston-start-at-startup directory with execution permissions.

Example script:

/home/root/app <- this is the proper graphical application

2. Optionally disable the current start_up_demo_launcher.sh by removing it's execution permisions.

I was looking for answer like that, that's shame that nobody propose this soloution earlier : /