[systemd-devel] Unexpecte behavior for timer with OnActiveSec

Andrei Borzenkov arvidjaar at gmail.com
Sat Nov 8 05:36:30 PST 2014


В Fri, 7 Nov 2014 08:56:49 +0000
"Paassen, Hiram van" <Hiram.van.Paassen at mastervolt.com> пишет:

> Hi,
> 
> We need to switch to a different target after 30 min of starting that target. Switching happens with isolate.
> So we have a timer with OnActiveSec=30min witch starts a service that calls systemctl isolate <other.target>
> 
> This works like a charm... the first time the target is activated. The second time we start that target nothing happens after 30 min.
> 
> After some manual testing I can conclude that a timer with OnActiveSec set will stay in elapsed state even after the timer has been restarted or stopped and then started. This is not what I expect. Also there seems to be no way to reset it to the waiting/running state except for the following procedure:
> 
> systemctl daemon-reload
> systemctl restart timer.timer
> 
> Is this expected behavior or a bug?
> 

It is not a bug as far as I can tell; but timer state should be reset
when unit it triggered changes state. So you have A.target that calls
B.timer that triggers B.target. Next time A.target tries to start
B.timer - is B.target still active?

P.S. actually the fact that you can restart timer after daemon-reload
is probably a bug :)


More information about the systemd-devel mailing list