DBus如何启动服务 [英] DBus how to start service

查看:926
本文介绍了DBus如何启动服务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我很好奇如何为DBus启动我自己的服务。
在官方站点上,我从客户端的角度发现了许多有关使用DBus服务的信息,但是如何启动和开发服务还不够:
1)接口文件ServiceName.xml应该放在哪里?
2)服务文件ServiceName.service
应该位于何处3)如何手动启动服务,而不是在系统启动时。

I am curious how to start my own service for DBus. On official site I have found a lot of information regarding working with DBus services from client point of view, but how to start and develop service not enough: 1) Where should be located interface file ServiceName.xml 2) Where should be located service file ServiceName.service 3) How to launch service manually, not on start of system.

任何人都可以帮助我或提供一些有用的链接?

Can anybody help me or provide some usefull links ?

推荐答案

使服务由OS的服务管理器启动(初始为systemd ,等等)。在该程序中,使用dbus库实例化服务器端对象。

Make a service that is started by the service manager of the OS (initd, systemd,etc). In that program instantiate the server-side object using the dbus library.

通常,您将配置为在引导时启动服务,但使用systemd时,也可以进行配置当某些东西连接到特定的套接字或某些东西试图使用特定的设备对象时,它开始。称为套接字激活和 dbus激活(请参阅​​当前的systemd文档)。

Normally, you'll configure to start the service on boot, but with systemd it's also possible to configure it to start when something connects to specific socket or when something tries to use specific device object. It's called 'socket activation' and 'dbus activation' (see current systemd docs).

如果您想手动启动服务,请执行 systemctl禁用< service-name> 以禁用启动启动。要手动启动服务: systemctl start< service-name>

If you want to start service manually - then do systemctl disable <service-name> to disable start on boot. To start a service manually: systemctl start <service-name>.

*。xml文件不是'强制性的。

The *.xml files aren't obligatory. Maybe look into other packages to see where they put these files.

*。systemd文件应该放在一些通常的位置(请参见systemd文档),例如 / usr / lib / systemd / system

The *.systemd files should be in some usual place (see systemd docs) like /usr/lib/systemd/system.

这篇关于DBus如何启动服务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆