Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. How to open a QT qml interface using systemd?
Forum Updated to NodeBB v4.3 + New Features

How to open a QT qml interface using systemd?

Scheduled Pinned Locked Moved Solved General and Desktop
6 Posts 3 Posters 896 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Z Offline
    Z Offline
    ziliombrom
    wrote on last edited by
    #1

    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.Service

    test is my binary, that runs my qml interface.

    How can I do this?

    Please if possible provide an example for my case.

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by SGaist
      #2

      Hi and welcome to devnet,

      Something like described here ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • Z Offline
        Z Offline
        ziliombrom
        wrote on last edited by
        #3

        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.

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          You might want to ensure that your application does not get started until DBus has been launched.

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          Z 1 Reply Last reply
          1
          • SGaistS SGaist

            You might want to ensure that your application does not get started until DBus has been launched.

            Z Offline
            Z Offline
            ziliombrom
            wrote on last edited by
            #5

            @SGaist Iḿ sorry I read again and it works, I just added: Environment="DISPLAY=:0".

            thank you

            J.HilkJ 1 Reply Last reply
            2
            • Z ziliombrom

              @SGaist Iḿ sorry I read again and it works, I just added: Environment="DISPLAY=:0".

              thank you

              J.HilkJ Offline
              J.HilkJ Offline
              J.Hilk
              Moderators
              wrote on last edited by
              #6

              @ziliombrom Don't forget to set your topic to solved via the topic tools then :D


              Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


              Q: What's that?
              A: It's blue light.
              Q: What does it do?
              A: It turns blue.

              1 Reply Last reply
              0

              • Login

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • Users
              • Groups
              • Search
              • Get Qt Extensions
              • Unsolved