[systemd-devel] Run script before the first systemd-timer is triggered? Systemd-timer in UTC?

Lennart Poettering lennart at poettering.net
Mon Apr 28 08:39:34 PDT 2014


On Mon, 28.04.14 07:48, Manuel Reimer (manuel.spam at nurfuerspam.de) wrote:

> Hello,
> 
> I want to run systemd on a embedded linux board. I have connected a RTC
> module via I2C.
> 
> What I want to do is to set the time via "hwclock --hctosys" during
> boot. 

I can only recommend to make sure that the kernel knows how to reach the
RTC, so that it comes up with the RTC initialized right-away.

> I have to do this before the first systemd-timer is triggered.
>
> How do I have to create my service-file to set the time as early as
> possible?
 
All timers by default are ordered after sysinit.target (unless this is
explicitly disabled via DefaultDependencies=no on the timer unit
files). Hence, if you order your services before sysinit.target (which
means the service should itself have DefaultDependencies=no), then you
should be fine. 

Also note that systemd will notice system clock changes and recalculate
the next elapsation.

> Second question: Do I have to use "localtime" for systemd timers or is it
> possible to set a timer wich, for example, is triggered daily at 04:00
> UTC?

Currently we only support the local timezone, but we have a TODO list
item to make it possible to specify times in UTC too. However, full
timezone support is going to be difficult, because the Unix timezone
APIs are so bad...

Lennart

-- 
Lennart Poettering, Red Hat


More information about the systemd-devel mailing list