why not exec .service
Tang Ke
tangk at lemote.com
Thu Feb 4 00:47:37 PST 2010
hi guys
I edit the /usr/share/dbus-1/system-services/com.example.Slow.service
[D-BUS Service]
Name=com.example.Slow
Exec=/home/tangke/slow.py
User=root
and the /home/tangke/slow.py file
import gobject
import dbus
import dbus.service
import dbus.glib
import time
class Slow(dbus.service.Object):
def __init__(self):
bus = dbus.SystemBus()
bus_name = dbus.service.BusName("com.example.Slow", bus)
super(Slow, self).__init__(bus_name, "/Object")
@dbus.service.method("com.example.Slow")
def function1(self):
print 'starting function1'
time.sleep(5)
print 'done with function1'
return 1
@dbus.service.method("com.example.Slow")
def function2(self):
print 'starting function2'
time.sleep(5)
print 'done with function2'
return 2
@dbus.service.method("com.example.Slow")
def function3(self):
print 'starting function3'
time.sleep(5)
print 'done with function3'
return 3
if __name__ == "__main__":
gobject.threads_init()
dbus.glib.init_threads()
when I reboot the machine,and run d-feet not found the com.example.Slow
but when I use the "python /home/tangke/slow.py" and run d-feet will
found the com.example.Slow
thanks in advance
best regards
tangk at lemote.com
More information about the dbus
mailing list