1
I need to run a Qt application on startup with root permission , below is the script I created using systemctl named QtApp.service
[Unit]
Description=QtApp
[Service]
ExecStart= exec su -l user -c 'export DISPLAY=:0; /QtInst/QtApp'
Restart=always
[Install]
WantedBy=multi-user.target
But when I run the command to start the service sudo systemctl start QtApp.service
I am getting following error
Failed to start QtApp.service: Unit QtApp.service is not loaded properly: Invalid argument.
Here is the details of error
systemctl status QtApp.service
● QtApp.service - QtApp
Loaded: error (Reason: Invalid argument)
Active: inactive (dead)
Jul 06 15:23:54 user-pc systemd[1]: [/etc/systemd/system/QtApp.service:5] Executable path is not absolute, ignoring: exec su -l user -c 'export DISPLAY=:0; /QtInst/QtApp'
Jul 06 15:23:54 user-pc systemd[1]: QtApp.service: Service lacks both ExecStart= and ExecStop= setting. Refusing.
Jul 06 15:26:08 user-pc systemd[1]: [/etc/systemd/system/QtApp.service:5] Executable path is not absolute, ignoring: exec su -l user -c 'export DISPLAY=:0; /QtInst/QtApp'
Jul 06 15:26:08 user-pc systemd[1]: QtApp.service: Service lacks both ExecStart= and ExecStop= setting. Refusing.
Actually the executable is in the folder in
/QtInst/
– CodeDezk – 2018-07-06T11:32:56.543Have you tried to delete the space after ExecStart= ? and set it in quotes, ExecStart="exec su -l user -c 'export DISPLAY=:0; /QtInst/QtApp'" – Andy Powers – 2018-07-06T11:39:07.180
No, I will try it – CodeDezk – 2018-07-06T11:45:18.167