Bug 76067

Summary: Optionally persist unit timestamps to enable anacron-like timers
Product: systemd Reporter: Jan Alexander Steffens (heftig) <jan.steffens>
Component: generalAssignee: systemd-bugs
Status: RESOLVED FIXED QA Contact: systemd-bugs
Severity: enhancement    
Priority: medium    
Version: unspecified   
Hardware: All   
OS: All   
Whiteboard:
i915 platform: i915 features:

Description Jan Alexander Steffens (heftig) 2014-03-12 10:37:13 UTC
Anacron-like timers (e.g. "run once a week, doesn't matter when") would require persistent timestamps in order to cope with reboots and downtimes.

I imagine that would involve keeping unit-like files in /var/lib/systemd/system (or $XDG_DATA_HOME/systemd/user) saving some of the timestamps with sections like:

[Persistence]
ActiveEnterTimestamp=...
InactiveEnterTimestamp=...

So that OnUnitActiveSec and OnUnitInactiveSec will be able to fire when the unit was last activated in a past boot.

Persistence of timestamps for a unit would be enabled if any timer enabling persistence and referencing the unit is activated.

Of course, anacron supports more features like randomizing start times to prevent stampeding and limiting the time-of-day range the jobs can be run, but this would be a nice start.
Comment 1 Lennart Poettering 2014-05-24 09:20:40 UTC
Persistent timers have been available since systemd 210 now. Closing.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.