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

Arian Van Putten arian at wire.com
Tue Nov 10 11:47:43 UTC 2020


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.



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 <https://wire.com/en/download/> - Secure team messaging.

 Zeta Project Germany GmbH  l  Rosenthaler Straße 40, 10178 Berlin, Germany
<https://maps.google.com/?q=Rosenthaler+Stra%C3%9Fe+40,%C2%A0+10178+Berlin,%C2%A0+Germany&entry=gmail&source=g>


Geschäftsführer/Managing Director: Morten J. Broegger

HRB 149847 beim Handelsregister Charlottenburg, Berlin

VAT-ID DE288748675
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/systemd-devel/attachments/20201110/1ce50b53/attachment.htm>


More information about the systemd-devel mailing list