[systemd-devel] On calendar timer
Lennart Poettering
lennart at poettering.net
Tue Jan 12 09:46:39 PST 2016
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
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
More information about the systemd-devel
mailing list