[systemd-devel] Timer: time format
Dave Reisner
d at falconindy.com
Tue Aug 23 11:46:12 UTC 2016
On Tue, Aug 23, 2016 at 11:38:57AM +0200, arnaud gaboury wrote:
> I am really sorry for this post as this may sound like a trivial one,
> but honestly the timer topic is difficult to understand for me (at
> least the time format).
>
> I am looking to run a service twice a day, never mind the time. I
> understand I must use OnCalendar, but I have no idea for the rest.
>
> I was thinking of OnCalendar=*:12:00 for running every 12 hours. Is
> it right (or will it run every day at noon) ?
This runs every hour on the 12 minute mark. You want '0,12:00' to run on
the 0 hour and 1200. Alternatively, you can always use multiple
OnCalendar= entries if that's easier for you to grok.
With less than 100 lines of code, one could write a tool which parses
calendar specs and spits out nice human-readable times for the next N
occurrences. Something like:
$ systemd-timespec-parse --next=5 0,12:00
Showing next 5 runs for: *-*-* 00,12:00:00
1: Tue 2016-08-23 12:00:00 EDT
2: Wed 2016-08-24 00:00:00 EDT
3: Wed 2016-08-24 12:00:00 EDT
4: Thu 2016-08-25 00:00:00 EDT
5: Thu 2016-08-25 12:00:00 EDT
Maybe this would save people some time... I know I'd make use of this.
d
More information about the systemd-devel
mailing list