Hi Simon, On 01.08.2012 21:35, Michael Biebl wrote: > since you were asking for a way to reliably stop D-Bus activated > services (on remove), see how it is done in udisks or upower, i.e. get > the pid via GetConnectionUnixProcessID for the bus name that is claimed > by wader-core, then simply use kill. > > http://anonscm.debian.org/gitweb/?p=pkg-utopia/upower.git;a=blob;f=debian/upower.prerm;h=6327e01d5a07bd4693a7b0822430a1ffac3fea1d;hb=HEAD
We use this code already in quite a few maintainer scripts (udisks, udisks2, upower, policykit-1, hal), get_pid() { [ -n "$1" ] || return 0 [ -S /var/run/dbus/system_bus_socket ] || return 0 dbus-send --system --dest=org.freedesktop.DBus --print-reply \ /org/freedesktop/DBus org.freedesktop.DBus.GetConnectionUnixProcessID \ string:$1 2>/dev/null | awk '/uint32/ {print $2}' } if [ "$1" = "remove" ]; then kill $(get_pid org.freedesktop.UPower) 2>/dev/null || true fi I'm wondering if we should add as small utiltily to dbus, say dbus-kill, which takes a D-Bus name so you'd only have to write: if [ "$1" = "remove" ]; then dbus-kill org.freedesktop.UPower || true fi Or something similar to that. Michael -- Why is it that all of the instruments seeking intelligent life in the universe are pointed away from Earth?
signature.asc
Description: OpenPGP digital signature