Solved How to open a QT qml interface using systemd?
-
I want to open a qml interface using systemd and when the user closes the window, the system automatically restarts the process to open the window again, but the interface doesn't open.
I tried this configuration:
[Unit]
Description=test
After=graphical.target
Wants=graphical.target[Service]
Type=simple
ExecStart=~/test
Restart=on-failure
RestartSec=10
KillMode=process[Install]
WantedBy=multi-user.target
Alias=test.Servicetest is my binary, that runs my qml interface.
How can I do this?
Please if possible provide an example for my case.
-
Hi and welcome to devnet,
Something like described here ?
-
Yes, but this solution didnt work to me, I get the error message: Failed to get D-Bus connection: Connection refused.
when I try just sudo systemctl start test.service I get the error:● test.service - test
Loaded: loaded (/usr/lib/systemd/system/test.service; disabled; vendor preset: disabled)
Active: failed (Result: start-limit) since Qui 2020-07-02 15:32:21 EDT; 8s ago
Process: 12033 ExecStart=/home/developer/Downloads/test (code=dumped, signal=ABRT)
Main PID: 12033 (code=dumped, signal=ABRT)Jul 02 15:32:21 localhost.localdomain systemd[1]: test.service: main process exited, code=dumped, status=6/ABRT
Jul 02 15:32:21 localhost.localdomain systemd[1]: Failed to start test.
Jul 02 15:32:21 localhost.localdomain systemd[1]: Unit viss.service entered failed state.
Jul 02 15:32:21 localhost.localdomain systemd[1]: test.service failed.
Jul 02 15:32:21 localhost.localdomain systemd[1]: test.service holdoff time over, scheduling restart.
Jul 02 15:32:21 localhost.localdomain systemd[1]: Stopped test.
Jul 02 15:32:21 localhost.localdomain systemd[1]: start request repeated too quickly for test.service
Jul 02 15:32:21 localhost.localdomain systemd[1]: Failed to start test.
Jul 02 15:32:21 localhost.localdomain systemd[1]: Unit test.service entered failed state.
Jul 02 15:32:21 localhost.localdomain systemd[1]: test.service failed. -
You might want to ensure that your application does not get started until DBus has been launched.
-
@SGaist Iḿ sorry I read again and it works, I just added: Environment="DISPLAY=:0".
thank you
-
@ziliombrom Don't forget to set your topic to solved via the topic tools then :D