2015-03-29 23:48 GMT+02:00 Max <maxim.sur...@campus.tu-berlin.de>: > 29.03.2015 21:28, T.C. Hollingsworth пишет: >> >> On Mar 29, 2015 9:52 AM, "Max" <maxim.sur...@campus.tu-berlin.de >> <mailto:maxim.sur...@campus.tu-berlin.de>> wrote: >> > >> > Hi. >> > >> > Is there a way to make timer unit which will execute things every X >> > minutes where X >> > is not divisor for 60? >> > In case of divisor it's obvious: >> > >> > [Timer] >> > OnCalendar=*:00/10 >> > >> > Will run every 10 minutes which nicely fit into 60 minutes hour. What if I >> > would like >> > to run things every 11 minutes: 0, 11, 22, 33, 44, 55, 66, 77... >> > >> > If I interpret >> > http://www.freedesktop.org/software/systemd/man/systemd.time.html >> > correctly than >> > OnCalendar=*:00/11 will run on 0, 11...44,55,0,11... resulting in >> > unevenness at the >> > end of an hour. >> > >> > Am I missing something? >> >> Yes. :-) See OnActiveSec and related options, listed right above OnCalendar >> in the >> documentation you linked to. >> > > You probably mean > http://www.freedesktop.org/software/systemd/man/systemd.timer.html > which is indeed easy to confuse with what I've linked too :) > > Unfortunately it doesn't have any examples :( > > [Timer] > OnActiveSec=11min > > Will this fire up once after the timer activation? How do I combine it with > other > directives to make it fire _every_ 11 minutes? > > cheers, > Max. > What you want is OnUnitActiveSec=11min. This will cause the service (or type of unit) associated with the timer unit to start every 11 minutes. But only if the service isn't still activated as I understand. OnActiveSec=11min will start the service once 11 minutes after the timer unit itself is started. There's also OnUnitInactiveSec where the service is started 11 minutes after it has stopped. This may be useful if your service may need more than 11 minutes until it exits.
In the man page it is recommended to combine OnUnitActiveSec with onBootSec to start the service once after boot and in regular intervals from then on. However there's one difference between these relative triggers and OnCalendar: you can only use Persistent= in combination with OnCalendar. This means that if your timer elapses in 5 minutes and you suspend your machine for an hour or so, after resume it still elapses in 5 minutes. Mirco _______________________________________________ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel