I've just developed a dbus client, writed in Python, to shows a desktop notification when it receives a message from a dbus service, which is launched by another user.

The dbus client code is here:


from gi.repository import Gtk
from gi.repository import Notify
import dbus
from dbus.mainloop.glib import DBusGMainLoop

bus = dbus.SystemBus()

def msg_handler(*args,**keywords):
        #show notification to desktop
        Notify.init('Pendrive Reminder')
        notify = Notify.Notification.new('Pendrive Reminder', 'Shutdown lock enabled. Disconnect pendrive to enable shutdown')

bus.add_signal_receiver(handler_function=msg_handler,    dbus_interface='org.preminder', path_keyword='path')

Now, I want to launch the dbus client from a script. But I need that this dbus client don't dead when script finish.

Also, I need that the dbus client to be launched as a specific (non root) user. The script will be executed as root.

I tried with this:

 nohup su user -c '/usr/bin/pendrive-reminder/client.py' &

But now the script keeps locked after finish its commands, shows as "defunct" process. So, I need to get that my script can finish after launch the dbus client

How can I solve this?

  • I need answer, please – AlmuHS Mar 26 '18 at 18:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.