Bug 76067 - Optionally persist unit timestamps to enable anacron-like timers
Summary: Optionally persist unit timestamps to enable anacron-like timers
Status: RESOLVED FIXED
Alias: None
Product: systemd
Classification: Unclassified
Component: general (show other bugs)
Version: unspecified
Hardware: All All
: medium enhancement
Assignee: systemd-bugs
QA Contact: systemd-bugs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-03-12 10:37 UTC by Jan Alexander Steffens (heftig)
Modified: 2014-05-24 09:20 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments

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.