Skip to main content
La1
Associate III
February 24, 2020
Solved

How to add program to autostart?

  • February 24, 2020
  • 8 replies
  • 3302 views

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.

This topic has been closed for replies.
Best answer by La1

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 : /

8 replies

Fee
Associate II
February 25, 2020

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
La1Author
Associate III
February 25, 2020

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
Associate II
February 25, 2020

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
Visitor II
February 26, 2020

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
February 26, 2020

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

--

http://purl.org/rzr

mleo
Visitor II
February 27, 2020

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

Milan

La1
La1Author
Associate III
April 23, 2020

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
La1AuthorAnswer
Associate III
May 11, 2020

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 : /