[systemd-devel] How can I simply check that a service has been restarted ?

Francis Moreau francis.moro at gmail.com
Tue Nov 10 13:20:23 UTC 2020


On Tue, Nov 10, 2020 at 12:47 PM Arian Van Putten <arian at wire.com> wrote:
>
> I think what you might want is `Type=exec` instead of `Type=simple` in your unit file.  It was recently added to systemd.
>
> then `systemctl restart` will return a failure when the main process fails to start. I hope that helps.

Thank you however I don't control the type of the restarted units, it
can be anything,

>
>
> On Tue, Nov 10, 2020 at 11:50 AM Francis Moreau <francis.moro at gmail.com> wrote:
>>
>> On Tue, Nov 10, 2020 at 11:30 AM Lennart Poettering
>> <lennart at poettering.net> wrote:
>> >
>> > On Di, 10.11.20 10:28, Francis Moreau (francis.moro at gmail.com) wrote:
>> >
>> > > Hello,
>> > >
>> > > After restarting a service with "systemctl try-restart ..." I want to
>> > > verify that the service has been restarted.
>> > >
>> > > How can I reliably do this without using the dbus API ?
>> >
>> > D-Bus is how systemd exposes its state. If you don't want to use that,
>> > you won't get the state information.
>> >
>>
>> dbus is overkill for my little bash script.
>>
>> --
>> Francis
>> _______________________________________________
>> systemd-devel mailing list
>> systemd-devel at lists.freedesktop.org
>> https://lists.freedesktop.org/mailman/listinfo/systemd-devel
>
>
>
> --
>
> Arian van Putten  l  Software Engineer
>
> @arian_wire on Wire
>
> Wire - Secure team messaging.
>
>  Zeta Project Germany GmbH  l  Rosenthaler Straße 40, 10178 Berlin, Germany
>
> Geschäftsführer/Managing Director: Morten J. Broegger
>
> HRB 149847 beim Handelsregister Charlottenburg, Berlin
>
> VAT-ID DE288748675



-- 
Francis


More information about the systemd-devel mailing list