DBus how to start service

20.5k views Asked by At

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

There are 1 answers

3
Velkan On BEST ANSWER

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.