Application cannot be autorun during startup on raspberry with systemd
-
Hi Together,
I am trying to automatically run a QGuiApplication on a raspberry pi 4 running raspbian with systemd.
The problem is, that the application is not starting automatically during startup, but if I trigger it manually with systemd (systemctl start <appname>), it starts properly, and the service is up and running.Here is my .service file:
[Unit] Description=Qt application autostart [Service] Type=simple User=pi Environment="DISPLAY=:0" WorkingDirectory=/home/pi/Desktop/new_HMI_version_b_r/build ExecStart=/home/pi/Desktop/new_HMI_version_b_r/build/BB_HMI_prototype [Install] WantedBy=graphical.target
Questions:
-
I left "Wanted by =" attribute open, as my understanding is, it lists dependents, which shalll be executed after my application is started, and since i dont have any dependents for now, its OK to ignore it. Correct?
-
I gave "WorkingDirectory=" the build folder of the application. I thinks its OK, but I have seen many examples on the internet that gave some system folder of the Pi... Shall something else be here?
-
What shall I put to attribute "WantedBy="? I think its the safest to give a dependency that my application launches as the last one triggered by systemd, so that every possible dependency is ready by then. Can I somehow explicitly force it to be started last by systemd?
Thank you for the answers in advance!
-