Bug 88725 - RFE: option to make timer units with Persistent=yes fire immediately the first time they are started
Summary: RFE: option to make timer units with Persistent=yes fire immediately the firs...
Status: NEW
Alias: None
Product: systemd
Classification: Unclassified
Component: general (show other bugs)
Version: unspecified
Hardware: x86-64 (AMD64) Linux (All)
: medium normal
Assignee: systemd-bugs
QA Contact: systemd-bugs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-01-23 00:48 UTC by me
Modified: 2015-02-04 13:51 UTC (History)
2 users (show)

See Also:
i915 platform:
i915 features:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description me 2015-01-23 00:48:01 UTC
A persistent timer that has not previously fired will not fire on startup, this is valid per a pedantic reading of the man page.  For the needs of an individual with a laptop it would be nice to not have to leave the laptop on overnight just to get a last-run timestamp so that Persistent works.  I haven't found a method to fake the timer having fired unfortunately.


Details showing how persistent=true behaves:

systemd 218
+PAM -AUDIT -SELINUX -IMA -APPARMOR +SMACK -SYSVINIT +UTMP +LIBCRYPTSETUP +GCRYPT +GNUTLS +ACL +XZ +LZ4 +SECCOMP +BLKID -ELFUTILS +KMOD +IDN

NEXT                         LEFT                LAST                         PASSED       UNIT                           ACTIVATES
Fri 2015-01-23 00:00:00 EST  4h 36min left       n/a                          n/a          zfs-auto-snapshot-daily.timer  zfs-auto-snapshot-daily.service

relevant unit parts:
[Timer]
OnCalendar=daily
Persistent=true


The above timer has been enabled on my laptop for the last 3 days.  My laptop is not on as midnight and so the timer doesn't fire.  

Another timer:

Thu 2015-01-22 20:00:00 EST  33min left          Thu 2015-01-22 19:00:15 EST  26min ago    zfs-auto-snapshot-hourly.timer zfs-auto-snapshot-hourly.service

Same basic idea, only hourly.  This DOES fire after my laptop comes out of suspend as shown here, snapshot names are in UTC, I put the EST time in last column
rpool/home@znap_2015-01-22-0300_hourly   15.7M      -  2.40G  -  - 10:00pm EST
rpool/home@znap_2015-01-22-1413_hourly   16.2M      -  2.40G  -  - 09:14am EST
rpool/home@znap_2015-01-22-1500_hourly   37.5M      -  2.40G  -  - 10:00am EST
rpool/home@znap_2015-01-22-1600_hourly   37.7M      -  2.40G  -  - 11:00am EST
Comment 1 Alexandre Detiste 2015-01-23 12:11:34 UTC
> I haven't found a method to fake the timer having fired unfortunately.
I can use 'touch' and set a date in the past + restarting the timer.

Can't help for the rest.


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.