DBus how to start service

我的未来我决定 提交于 2019-12-13 00:35:07

问题


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 ?


回答1:


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.

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

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

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

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



来源:https://stackoverflow.com/questions/41272567/dbus-how-to-start-service

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!