Invalid DBus.service file

I create my own dbus service for my own requirements and want it to start automatically when someone needs it. For this, I created a .service file similar to this

 [D-Bus Service] Name=com.mycompany.servicename Exec=/home/myuser/Workspace/service-start User=myuser 

Here I just changed the actual name of the service and the executable, but that is not the point. I double-checked the real names - it exactly matches. I placed this file under the name com.mycompany.servicename.service in the / usr / share / dbus -1 / services folder (I use Ubuntu 11.10) The executable has x permissions for everyone. And here is the problem - when I try to start a client that runs

 bus = dbus.SessionBus() bus.get_object('com.mycompany.servicename','/path/to/object') 

I get dbus.exceptions.DBusException: org.freedesktop.DBus.Error.ServiceUnknown: The name com.mycompany.servicename was not provided by any .service files

An object with the path '/path/to/object' registered immediately after the service starts. I just don't understand why dbus cannot find my .service file. Maybe I missed something? Any ideas?

Edit I was able to start D-BUS automatically using a script. The section of the .service file should be named [D-BUS Service] instead of [D-BUS Service]

+4
source share
1 answer

Here is a summary of the comments ...

Create a dbus-1/services/ subdirectory in one of the directories named in the XDG Base Directory Specification . Normally ~/.local/share/dbus-1/services/ works fine. Enter a new subdirectory, create a file called com.mycompany.servicename.service and add the lines:

 [D-BUS Service] Name=com.mycompany.servicename Exec=/home/myuser/Workspace/service-start User=myuser 

Note that the D-BUS in the [D-BUS Service] needs to be ironed out.

What is it!

+2
source

Source: https://habr.com/ru/post/1395384/


All Articles