TECHNOLOGY

systemd-run wait observes unit completion rather than just queued activation

In this article
THE QUICK TAKE

The systemd-run manual defines --wait as waiting synchronously for the transient service to deactivate after its start request is verified and queued. When waiting, the command reports runtime and main-process exit information, subject to output options. Its exit status reflects the service outcome, including statuses systemd considers clean according to settings such as SuccessExitStatus. This is different from concluding that the underlying application result is correct merely because acti.

A deployment script can launch a transient unit successfully and still miss that the command later failed. systemd-run separates submitting or starting a service from waiting for its completion. When the next release step depends on a finished artifact preparation or validation task, the distinction affects whether an automation chain proceeds on evidence or only on an accepted activation request.

The service-manager contract

The systemd-run manual defines —wait as waiting synchronously for the transient service to deactivate after its start request is verified and queued. When waiting, the command reports runtime and main-process exit information, subject to output options. Its exit status reflects the service outcome, including statuses systemd considers clean according to settings such as SuccessExitStatus. This is different from concluding that the underlying application result is correct merely because activation was accepted.

Implementation details

Choose the service type deliberately and capture the effective unit name, execution settings and final result. The manual notes that default simple activation can be considered started before execve succeeds; Type=exec offers a different startup boundary. Waiting still answers a later question: did the unit finish under its configured success rules? Keep output and result handling explicit in the caller. Review documented incompatibilities, including combining —wait with —no-block, —remain-after-exit, —scope or trigger-unit options.

A constructed validation case

Construct a harmless transient task that starts, pauses and deliberately exits unsuccessfully. Compare ordinary activation with waiting, recording when the caller returns and which outcome it receives. Add a successful task that writes a test artifact, then validate that artifact separately. Include an explicitly accepted nonstandard clean-exit status to show why the caller’s success code depends on unit policy. Preserve failed-unit evidence before aggressive collection removes inspectable state, and label every branch as a proposed local validation.

Recovery limits

Waiting is not independent verification of model files, numerical results or downstream side effects. A command can exit cleanly after producing an incomplete artifact unless it validates its own contract. Conversely, a failure can leave partial external work requiring cleanup. Keep completion, success classification and artifact acceptance as separate fields. This makes a release procedure reviewable and prevents a successful transient-unit launcher from being mistaken for a successfully completed model deployment.

Primary references

systemd systemd-run documented interface; systemd systemd.service documented interface.

This is a proposed service-lifecycle validation, not an executed Retrivium benchmark. Preserve the implementation version and unresolved outcomes; interface documentation does not establish the availability or correctness of an inference service.

Terminal request records: reconcile stream, usage and logs; Golden inference API fixtures: test the contract rather than prose.

Earn rental income from GPUs

Have idle GPUs or looking to fund AI infrastructure? Retrivium finds a rental platform, sets up the server and helps you assess income and costs with a pilot.

Explore GPU hosting
← All articles