Re: [systemd-devel] On calendar timer

2016-01-12 Thread Lennart Poettering
On Wed, 06.01.16 17:17, arnaud gaboury (arnaud.gabo...@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

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
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] On calendar timer

2016-01-12 Thread arnaud gaboury
On Tue, Jan 12, 2016 at 6:46 PM, Lennart Poettering
 wrote:
> On Wed, 06.01.16 17:17, arnaud gaboury (arnaud.gabo...@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
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] On calendar timer

2016-01-12 Thread Lennart Poettering
On Tue, 12.01.16 19:13, arnaud gaboury (arnaud.gabo...@gmail.com) wrote:

> > 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 ?

YOu can use After= between the service units you trigger, if you like.

But if it's not a problem that all your services run in parallel, by
all means run them in parallel, and specify the same time of 2:00...

Lennart

-- 
Lennart Poettering, Red Hat
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


[systemd-devel] On calendar timer

2016-01-06 Thread arnaud gaboury
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?

Thank you for help

-- 

google.com/+arnaudgabourygabx
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel