首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何将qtdbus应用程序作为systemd运行?

如何将qtdbus应用程序作为systemd运行?
EN

Unix & Linux用户
提问于 2020-12-03 06:34:53
回答 1查看 225关注 0票数 0

见到你很高兴。

我创建了一个应用程序(car<->控制器),它使用Qt提供的qtdbus进行通信。看见。https://doc.qt.io/qt-5/qtdbus-remotecontrolledcar-example.html

幸运的是,我能够验证应用程序的通信是否正常。

但是,当我使用systemd在系统启动时自动运行应用程序时,我遇到了没有通信的问题。

下面是我写的服务。

控制器系统服务

代码语言:javascript
复制
[Unit]
Description=Controller App execution 
ConditionPathExists=/var/run/user/root/wayland-0

[Service]
Type=dbus
BusName=org.example.CarExample.service
EnvironmentFile=/etc/sysconfig/weston
ExecStart=/home/root/controller_app
WorkingDirectory=/home/root/

[Install]
WantedBy=multi-user.target

汽车系统服务

代码语言:javascript
复制
[Unit]
Description=Car app execution
ConditionPathExists=/var/run/user/root/wayland-0

[Service]
Type=dbus
BusName=org.example.CarExample.service
EnvironmentFile=/etc/sysconfig/weston
ExecStart=/home/root/car_app
WorkingDirectory=/home/root/

[Install]
WantedBy=multi-user.target

我的qdbus服务

代码语言:javascript
复制
[D-BUS Service]
Name=org.example.CarExample.service
Exec=/usr/bin/car_dbus

我的目的是让使用qtdbus的两个应用程序在系统引导时正常工作。

看来你现在走错路了。

我还应该找什么呢?

EN

回答 1

Unix & Linux用户

回答已采纳

发布于 2020-12-04 01:25:46

找到答案了。

问题是如何在系统区域实现服务。

已经发现,qtbus在用户区域进行通信。

因此,如果在systemd的用户区域中创建了服务,则可以确认它在没有连接到dbus服务的情况下正常运行。

票数 0
EN
页面原文内容由Unix & Linux提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://unix.stackexchange.com/questions/622670

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档