.Service File D-Bus

I am trying to start autostart of the DBus service when starting my client program. I installed the .service file, but it does not work.

My service name

org.fandingo.PMP 

I will register the name on python server with

  name = dbus.service.BusName('org.fandingo.PMP', session_bus) object = PMPService(session_bus, '/PMPService', PMPProxy()) 

I can connect to this penalty if I manually run the server code with the following:

 remote = bus.get_object('org.fandingo.PMP', '/PMPService') 

Thus, the server and client work when called 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 other .service files.

The contents of the .service file

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

Anyone see any problems with me?

Thanks,

+4
source share
1 answer

Finally invented it.

I am not sure exactly how .service files are executed, but they do not get / bin / env correctly.

My shebang did not work 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 

Now everything is working fine.

+1
source

All Articles