[systemd-devel] On calendar timer

arnaud gaboury arnaud.gaboury at gmail.com
Tue Jan 12 10:13:02 PST 2016


On Tue, Jan 12, 2016 at 6:46 PM, Lennart Poettering
<lennart at poettering.net> wrote:
> On Wed, 06.01.16 17:17, arnaud gaboury (arnaud.gaboury at gmail.com) wrote:
>
>> I am not sure about how to express date/time in a timer unit.
>>
>> I want the timer to be start every year(*), on month 1,3,5,7,9,11,
>> first day of month at 02:00:00 AM. Here is what I wrote:
>>
>> [Timer]
>> OnCalendar=*-1,3,5,7,9,11-01 02:00:00
>>
>> Is this correct ?
>>
>> Now if I want instead not the first day of the cited months, but the
>> first Sunday:
>>
>> OnCalendar=Sun, *-1,3,5,7,9,11-01 02:00:00
>>
>> Or the above will only trigger the service IF first day of the cited
>> month is a Sunday?
>
> The latter. Basically, for each element in the expression one item of the
> specified list must hold for the event to trigger.
>
> To express what you want to express I'd just list all days of the
> first week.
>
>     Sun 1,3,5,7,9-1,2,3,4,5,6,7 02:00

Very good. If I follow you correctly, the service will be triggered on
month 1,3,5,7,9, 11 (in fact, every two months. I do not care which
one indeed),  on the first Sunday of these months at 2:00 AM. That is
exactly what I want.
As a side note, I will need to trigger like 8 services at this moment
(in fact, it is a letsencrypt ssl web certificate auto renewal for all
my subdomains). It seems there is no After= for timer, so best would
be to set, say 2:00, 2:05, 2:10 etc (the ssl renewal just need less
than one minute). Or simpler, let 2:00 for all of them ?


>
> Which means: on every sunday, that is one of the first 7 days of the
> months 1, 3, 5, 7 or 9, at 2am.
>
> Of course, we should probably introduce a ".." syntax so that
> 1,2,3,4,5,6,7 could be written as "1..7". Happy to take a patch for
> that.
>
> Hope this is useful.
>
> Lennart
>
> --
> Lennart Poettering, Red Hat



-- 

google.com/+arnaudgabourygabx


More information about the systemd-devel mailing list