Maybe basic Linux/Pi question

I realise this may be more of a Linux question… however..
I have a Pi4 with the latest OS installed.

I’m using the Pi to display a vehicle dashboard with software called TS Dash. Its installed and working perfectly if I execute the TSDash.sh file from command line..

However, when I’ve created a .service file to launch it at startup I get this error:

pi@pi: S cat clock.log
Jar Name: TSDash.jar
Registration file not found.
03/04/2025, 21:25:18 : Debug: Unable to load user properties, looking in /home/pi/TSDash/.

The first section:

pi@pi: S cat clock.log
Jar Name: TSDash.jar

Is present when the software launches normally from command line. Its only the "registration file not found etc.. that appears when I try to use the service file.
This is the .service file I’m using:

[Unit]
Description=start dashboard

[Service]
Enviroment=DISPLAY=:0
Enviroment=XAUTHORITY=/home/pi/.Xauthority
ExecStart=/bin/bash -c '/home/pi/TSDash/TSDash.sh > /home/pi/clock.log 2>&1'
Restart always
RestartSecs=10s
KillMode=process
TimeoutSec=infinity

[Install]
WantedBy=graphical.target

Can anyone with better Linux knowledge see anything obvious that I am missing?

*I have wondered if its because when I execute from command line I’m doing it as a user and maybe the .service is run as root?

See Bash script invoked by SystemD that starts GUI app - Unix & Linux Stack Exchange

I would nevertheless suggest that you use the standard xdg autostart mechanism to start GUI-programs. Inspect your autostart folders for blueprints. There is a system-wide folder somewhere below /etc, I think /etc/xdg/autostart, and a user-specific folder in your home-directory. I don’t have a running Pi up right now, but on my desktop it is $HOME/.config/autostart.

Thanks, I moved to the .service method when I failed to get it to run using the autostart method :)
My install of the Pi OS doesn’t have autostart folders, so I wondered if they had been depreciated.. I created my own /.config/autostart folders to try but could never get it to run and find that debugging autostarts isn’t easy.
When I get home later I’ll run a system search for /autostart folders as maybe they are not in the .config/ folders I was expecting.. I certainly did not look under the xdg folder as you suggest.

Oh yes, PiOS uses Wayfire on modern systems and openbox on older systems. Using find /etc/ -name autostart turns up a number of hits, one is /etc/xdg/openbox/autostart and a number of scripts below /etc/xdg/lxsession.

I don’t think that xdg is deprecated, but I am not sure that software developers (including those from the Pi-Foundation) are always aware of the standards.

But maybe the link from Stack Exchange already does what you want to do. Some feedback would be appreciated, since not everything that worked in the past still works.

1 Like

If you are on the latest (bookworm) os you are probably using “labwc”, not X11. You can create a file called
~/.config/labwc/AUTOSTART
to start your script. This would insure the desktop was running before starting your script.

Services don’t run under you usercode unless specified. The path to the jar files may not be included in the default “$PATH”.

Curt

SUCCESS!
Its one of those things that in hindsight it was very simple, but I couldn’t have done it without your help.
I have a simple script:

[Desktop Entry]
Type=Application
Name=Dash
Exec=/home/pi/TSDash/TSDash.sh

And tried placing it the various autostart folders one at a time… the one that worked was/etc/xdg/autostart

Many thanks!

1 Like