[systemd-devel] Waiting for all jobs to finish

Barry Scott barry at barrys-emacs.org
Wed Apr 27 17:29:47 UTC 2022


I have two target files that I use.

prod.target is used to start up all the production services.
When I use systemctl start prod.target it blocks until all the
services are running.

I also have prod-upgrade.target that is used to stop service
via Conflicts=. When I use systemctl start prod-upgrade.target
it returns immediately but there are stop jobs running.

I believe that this is expected as all the services that need to
be started have been.

Is there a systemctl command that will wait for all the stop jobs
without the need to poll for the systemctl list-jobs to be empty?

The pattern I'm implementing is to do this on a server upgrade:

systemctl start prod-upgrade.target
# need to wait for stop jobs to finish
dnf update --refresh -y
systemctl start prod.target

Barry



More information about the systemd-devel mailing list