I need to write a timer unit for a machine which is turned of frequently (e.g. classical desktop setup). This timer unit needs to be activated regularly but not very often (e.g. weekly, monthly).I did find some approaches but they all don't really fit:According to the man pages only the OnBootSec and the OnStartupSec directives will be activated if the configured point of time is in the past. I found as well some examples using a combination of these with OnActiveSec to define a regular event. The problem is: Every time the machine is booted the timer will activate the configured unit. If you got a timer which should run ONCE a week/month that is far too often. For example: I don't want to get my logs rotated three times a day...Solutions with the OnCalendar directive. If the machine is powered off at the configured point in time (mostly midnight because if you omit the hour in the time specification it defaults to 00:00:00) the timer won't be activated after the next boot. That's at least how I got it. Is that right ?So here comes the question:Are timer with calendar events activated right after the next startup if the configured time is in the past ?If not: Is there a workaround to get such a behaviour ?
systemd - Timer units that mimic anacron behaviour
cron;systemd