Auto strat app on desktop use custom.sh

Guys I am looking for help on how to setup an auto start of an app once desktop is running.

I tried boot scripts via dietpi-config > AutoStart options > Custom. I added my command to /var/lib/dietpi-autostart/custom.sh

#!/bin/bash
#---Examples---

# - Chromium
#xinit chromium

# - LXDE
#startx

# - Print hello
#echo -e "Hello"

#---Put your code below this line---
echo -e "Start in few second"
sleep 15
echo -e "start"
sleep 4
startx
sleep 10
./home/dietpi/electron-tutorial-app-linux-armv7l/electron-tutorial-app

but durring the sleep, i could see on the console the login banner ask to “hit enter” and then when the command startx is call the desktop start but i got an error popup “no session for pid 658” then the electron-tutorial-app didn’t strat. :cry:

however when i call the command

systemctl status dietpi-autostart_custom

i got an “Active: active (running)”

hope i was clear

Much Thanks in advance

Hi,

many thanks for your message. I guess you are trying to start automatically an application once desktop was started. Correct?

dietpi-autostart/custom.sh might not be the correct place.

Maybe you can have a look to the following links
https://www.raspberrypi-spy.co.uk/2014/05/how-to-autostart-apps-in-rasbian-lxde-desktop/
https://learn.sparkfun.com/tutorials/how-to-run-a-raspberry-pi-program-on-startup/method-2-autostart

hi Joulinar :slight_smile:

It works !!

I used the methode 1 of https://www.raspberrypi-spy.co.uk/2014/05/how-to-autostart-apps-in-rasbian-lxde-desktop/ with the add of the ligne

@/directory/of/my/app/myapp

to the /etc/xdg/lxsession/LXDE/autostart.

Thanks for you help ! :slight_smile: