In this article
systemd.service defines RuntimeMaxSec as the maximum time an active service may run before termination and failure. It has no effect on Type=oneshot, whose activation should instead be bounded with TimeoutStartSec. Supported notify services can extend runtime through the documented EXTEND_TIMEOUT_USEC protocol, with the initial extension arriving before the active deadline. RuntimeRandomizedExtraSec can also alter the effective bound when configured. These mechanisms require explicit account.
A GPU worker can spend considerable time initializing before it begins serving and additional time draining when it stops. RuntimeMaxSec should not be interpreted as a single wall-clock budget covering all those phases. It limits the service’s running phase under the service-manager contract. Startup and shutdown deadlines remain separate controls with different failure paths.
The service-manager contract
systemd.service defines RuntimeMaxSec as the maximum time an active service may run before termination and failure. It has no effect on Type=oneshot, whose activation should instead be bounded with TimeoutStartSec. Supported notify services can extend runtime through the documented EXTEND_TIMEOUT_USEC protocol, with the initial extension arriving before the active deadline. RuntimeRandomizedExtraSec can also alter the effective bound when configured. These mechanisms require explicit accounting in any planned runtime policy.
Implementation details
Maintain separate timestamps for activation beginning, readiness, runtime expiry and termination completion. Select the service type deliberately, because its definition of completed startup determines the phase boundary. Treat a runtime limit as a lifecycle policy, not a request-specific timeout or a daily cost cap. A restart policy may start another lifecycle after termination, so repeatedly bounded runs can still form continuous activity. Decide how admission changes before an intended expiry and how unfinished requests are reported.
A constructed validation case
Build a disposable notifying worker with controlled initialization, serving and drain phases. First keep initialization within its startup allowance and observe when the runtime window begins. Compare a run that expires with one that terminates normally before expiry. Add a separate oneshot fixture to show that RuntimeMaxSec is not its activation deadline. Keep notification extensions disabled for the baseline, then test an explicitly marked extension branch. Record phase transitions rather than equating total process age with active runtime.
Recovery limits
A runtime cap does not establish useful progress or diagnose a hung accelerator. Watchdog and functional observations answer different questions. Total maintenance time can exceed the runtime interval because startup and stopping have their own contracts. Preserve the effective settings and failure reason when comparing runs. Do not promise a maximum invoice or successful request completion from this directive alone; establish those outcomes with separate application and accounting controls.
Primary references
systemd systemd.service documented interface; systemd systemd.unit 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.
Related reading
Graceful inference-server termination with active streams; Keep a service watchdog tied to useful progress.
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.