[systemd-devel] Question about OnUnitInactiveSec= directive

Andrei Borzenkov arvidjaar at gmail.com
Sat Jul 9 05:23:51 UTC 2016


09.07.2016 01:37, Mikhail Kasimov пишет:
> Hello!
> 
> Have a .timer service like:
> 
> ======
> 
> [Unit]
> Description=Runs VBA32 Update Hourly
> Requires=timers.target
> 
> [Timer]
> OnBootSec=2min
> OnUnitInactiveSec=1h
> 
> [Install]
> WantedBy=timers.target
> 
> ======
> 
> to run vba32update.service in 1 hour after previous update-session is
> over (OnUnitInactiveSec=1h).
> 
> From man-page: "|OnUnitInactiveSec=| defines a timer relative to when
> the unit the timer is activating was last deactivated."
> 
> Ok, here is log-snippet:
> ======
> Июл 08 22:05:00 linux-mk500 systemd[1]: Starting VBA32 Anti-Virus Update
> Service...
> Июл 08 22:05:00 linux-mk500 vbacl[14768]: Vba32 console scanner update
> process started
> Июл 08 22:05:00 linux-mk500 vbacl[14768]: Reading configuration options
> from ./vbacl.ini
> Июл 08 22:05:00 linux-mk500 vbacl[14768]: Using direct connection for
> update
> Июл 08 22:05:02 linux-mk500 vbacl[14768]: Current dir is ./
> Июл 08 22:05:02 linux-mk500 vbacl[14768]: Start update from
> http://anti-virus.by/update
> Июл 08 22:05:02 linux-mk500 vbacl[14768]: Receiving file list
> Июл 08 22:05:02 linux-mk500 vbacl[14768]: File list received
> Июл 08 22:05:02 linux-mk500 vbacl[14768]: Update is not needed
> Июл 08 22:05:02 linux-mk500 systemd[1]: Started VBA32 Anti-Virus Update
> Service.
> 
...

> 
> We see 22:05:02 (end of update-session) --> 23:05:13 (start of next
> update-session) --> 23:05:17 (end of update-session) --> 00:05:20 (start
> of next update-session) --> 00:05:24 (end of update-session) -->
> 01:05:50 (start of next update-session) --> 01:05:55 (end of
> update-session).
> 
> Question: Why time of new update-session is *not* equal to time of end
> of previous update-session + 1h in section of seconds, e.g. 23:05:17 +1h
> = 00:05:17; 00:05:24 + 1h = 01:05:24 and so on? Is here a way to reach
> this precise coincidence?
> 

Please check with "systemctl status" or "systemctl show" when unit was
actually deactivated. Also see "AccuracySec" timer parameter.



More information about the systemd-devel mailing list