[systemd-devel] Query degraded state

Barry Scott barry at barrys-emacs.org
Thu Apr 28 19:29:18 UTC 2022


On 28/04/2022 16:15, Alvin Šipraga wrote:
> Hi,
>
> On Thu, Apr 28, 2022 at 04:03:01PM +0100, Barry Scott wrote:
>> Is there a command I can use to test for the degraded state?
>>
>> I could parsing the output of systemctl-failed or
>> syetemctl status but was looking for something less fragile.
> I think the correct way to do this programatically is via the dbus API, but if
> you want something moderately greppable, try:
>
> # systemctl show | grep SystemState
> SystemState=running

Thanks that will work well in a bash script.

I put off using dbus for a little longer :-)

Barry

>
> Hope that helps.
>
> Kind regards,
> Alvin


More information about the systemd-devel mailing list