[systemd-devel] DBus's PropertiesChanged signal is not triggered when an Unit stop successfully

Jan Alexander Steffens jan.steffens at gmail.com
Thu May 26 09:59:57 UTC 2016


You need to listen to JobRemoved signals. All of them, before you start
your job - trying to match on the specific job you get back from StopUnit
might not complete before the job is already removed.

On Thu, May 26, 2016 at 8:20 AM Adrien Besnard <adrien.besnard at gmail.com>
wrote:

> I managed to do what I wanted to do using add_timeout with the GLib's
> MainLoop: I poll every second the state of the unit and manually call the
> callback connected to DBus to fake the event when the unit is stopped.
>
> It works but this is a dirty hack. So I'm still interested by a real
> solution :)
>
> Cheers!
> Le 23 mai 2016 11:55, "Adrien Besnard" <adrien.besnard at gmail.com> a
> écrit :
>
>> Hello,
>>
>> I'm trying to make a small Python script which send an email when a *Type=oneshot
>> *service ends (either in success or in failure).
>>
>> To do that, I'm using the dbus binding for Python, and connecting to the
>> *PropertiesChanged* signal on the unit I'm monitoring.
>>
>> It works great when the process fails (the signal is triggered and I see
>> *ActiveState* and *SubState* refleting the failure) but not when the
>> service end successully.
>>
>> All I see is an *UnitRemoved* signal triggered by the manager
>> interface... Is that normal?
>>
>> Do you guys have an idea of what I'm missing here?
>>
>> Thanks!
>> --
>> Adrien BESNARD
>>
> _______________________________________________
> systemd-devel mailing list
> systemd-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/systemd-devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/systemd-devel/attachments/20160526/365ff799/attachment-0001.html>


More information about the systemd-devel mailing list