TECHNOLOGY

A systemd timer does not restart a target service that is already active

In this article
THE QUICK TAKE

The systemd.timer manual states that a unit already active when its timer elapses is left running and is not restarted. The mechanism does not spawn a new service instance in that case. It specifically warns that RemainAfterExit=yes is usually unsuitable for repeatedly timer-activated services because they stay active after the command finishes. The timer's own active state and the triggered service's active state are separate observations with separate meanings.

Periodic GPU maintenance, catalog refresh or synthetic probing is often implemented as a timer-triggered service. A timer firing while that service is still active does not imply another job instance was launched. Ignoring this detail can make a monitoring schedule appear to have completed more work than actually ran, or conceal that a retained active state prevents future executions.

The service-manager contract

The systemd.timer manual states that a unit already active when its timer elapses is left running and is not restarted. The mechanism does not spawn a new service instance in that case. It specifically warns that RemainAfterExit=yes is usually unsuitable for repeatedly timer-activated services because they stay active after the command finishes. The timer’s own active state and the triggered service’s active state are separate observations with separate meanings.

Implementation details

Define whether the maintenance task is allowed to overlap and what happens when its runtime exceeds the planned interval. Do not infer a durable backlog of missed executions from the timer directive alone. Record actual task starts and completed outcomes in application-level accounting. For a one-time command, review the service type and retained-state settings before attributing missing runs to scheduler failure. Distinguish intentionally suppressed overlap from a hung command that no longer makes progress.

A constructed validation case

Create a timer and harmless task that deliberately remains active across another scheduled trigger. Compare timer events with the task’s start records and process identities. Repeat after allowing the service to become inactive, then compare a oneshot task with and without RemainAfterExit. Include a task that finishes unsuccessfully and retain its outcome independently of later timer activity. The test should demonstrate actual invocation count and state transitions rather than treating every elapsed timer event as completed maintenance.

Recovery limits

This behavior is not a general distributed locking or exactly-once guarantee. Multiple differently named services or another scheduler can still invoke the same underlying operation. Application idempotence and ownership remain relevant. Other timer settings control when events are considered due and must be reviewed separately. Use the active-target rule to understand local activation, and base freshness claims on successful task outcomes with timestamps, not merely on the presence of an enabled timer.

Primary references

systemd systemd.timer 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.

Desynchronize automatic service restarts with the supported systemd delay; Terminal request records: reconcile stream, usage and logs.

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