I'm using a Laptop with GNU/Linux and I would like certain jobs to run automatically on certain calendar events even if the machine was off.

I understand I should use the OnCalendar= directive but how can I make sure that if the machine was off during that time, the corresponding service unit will run after the next boot?


Use the Persistent= directive. Quoting from the manual:

           Takes a boolean argument. If true, the time when the service unit
           was last triggered is stored on disk. When the timer is activated,
           the service unit is triggered immediately if it would have been
           triggered at least once during the time when the timer was
           inactive. This is useful to catch up on missed runs of the service
           when the machine was off. Note that this setting only has an effect
           on timers configured with OnCalendar=. Defaults to false.

Since the desired behavior is kind of hard to describe, this is probably the best keyword that could have been selected.

Another option, not using systemd could be using fcron, which is an enhanced version of the traditional cron now implemented as vixie cron on GNU/Linux systems and others. You can use it's bootrun option in your tables. See an example here, quoting:


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.