12.07.2020 23:37, Uoti Urpala пишет:
> On Sun, 2020-07-12 at 17:13 +0300, Andrei Borzenkov wrote:
>> 12.07.2020 16:21, Amish пишет:
>>> I have a timer file like this:
>>>
>>> [Unit]
>>> Description=Foo
>>> After=multi-user.target
>>>
>>> [Timer]
>>> OnCalendar=*:0/5
>>> Persistent=false
>>>
>>> [Install]
>>> WantedBy=timers.target
> 
> 
>>> Because AFAIK timers.target runs before multi-user.target. But here
>>> something inside timers.target waits for multi-user.target.
>>>
>>> So how does systemd resolve this loop?
>>>
>>
>> There is no loop. There is no transitive dependency between timer unit
>> and service unit. Timer unit gets started early and enqueues start job
>> for service unit; this start job waits for multi-user.target according
>> to After dependency. Mulitple invocation of timer will try enqueue start
>> job again which will simply be merged with existing pending request.
> 
> But shouldn't the After line be in the .service file, not the timer, in
> this case? The timer should be ready early if it's activated by
> timers.target, the service should wait before running.
> 

Sorry, I did not pay attention.

In this case there is no loop as well, because timers.target itself does
not have any Before dependencies by default. So timer.target becomes
active after multi-user.target but it does not really affect anything.
In particular other timers will be activated as soon as possible, they
won't be delayed until timers.target is active.
_______________________________________________
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel

Reply via email to