systemctl: add support for --wait to is-system-running

System Internals / systemd - Filipe Brandenburger [google.com] - 7 August 2018 07:33 EDT

This makes it possible to wait until boot is finished without having to poll for this command repeatedly, instead using the syntax:

$ systemctl is-system-running --wait

Waiting is implemented by waiting for the StartupFinished signal to be posted on the bus.

Register the matcher before checking for the property to avoid race conditions.

Tested by artificially delaying startup with a oneshot service and calling this command, checked that it emitted `running` and exited with a 0 return code as soon as the delay service completed startup.

Also tested that booting to degraded state unblocks the command.

Inserted a delay between getting the property and waiting for the signal and confirmed this seems to work free of race conditions.

Updated the --help text (under --wait) and the man page to document the new feature.

adb6cd9be systemctl: add support for --wait to is-system-running
man/systemctl.xml | 12 +++++++++++
src/systemctl/systemctl.c | 54 ++++++++++++++++++++++++++++++++++++++++++++++-
2 files changed, 65 insertions(+), 1 deletion(-)

Upstream: github.com


  • Share