I'm trying to auto-start a DBus service when my client program starts. I've setup a .service file, but it's not working.
My service name is
org.fandingo.PMP
I register the name with a python server with
name = dbus.service.BusName('org.fandingo.PMP', session_bus)
object = PMPService(session_bus, '/PMPService', PMPProxy())
I can connect to this fine if I manually run the server code with the following from the client
remote = bus.get_object('org.fandingo.PMP', '/PMPService')
So the server and client both work if invoked manually. If I just try the client, I get the following Python exception
dbus.exceptions.DBusException: org.freedesktop.DBus.Error.ServiceUnknown: The name org.fandingo.PMP was not provided by any .service files
Here is my .service file
-rw-r--r--. root root unconfined_u:object_r:usr_t:s0 /usr/share/dbus-1/services/org.fandingo.PMP.service
These permissions and SELinux labels are identical to the other .service files.
The .service file contents
[D-Bus Service]
Name=org.fandingo.PMP
Exec=/home/fandingo/code/python/pmp/src/pmpserver.py
User=fandingo
pmpserver.py is executable and has the correct shebang.
Does anyone see any problems with me configuration?
Thanks,
Finally figured this one out.
I'm not sure exactly how .service files are executed, but they don't get /bin/env set properly.
My shebang was not working properly:
#!/usr/bin/env python
I changed my service file to
[D-Bus Service]
Name=org.fandingo.PMP
Exec=python /home/fandingo/code/python/pmp/src/pmpserver.py
Everything works great now.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With