[systemd-devel] Add timer exception
Jérémy Rosen
jeremy.rosen at smile.fr
Mon Nov 5 09:05:42 UTC 2018
I would have my timer be duration-based instead of calandar based
(assuming that fits your need)
You could use one of the following
OnActiveSec=48h (two days after the timer last triggered
OnUnitActiveSec=48h (two days afte the unit was last started)
Or slightly different
OnUnitInactiveSec=24h (one day after the service FINISHED)
In all those cases, since this is interval based, you would need a way
to "prime the pump" I usually do this with
OnStartupSec=15m (1/4h after the machine was started)
or simply by enabling the service itself so it's part of the boot
sequence (this will work with OnUnitActive and OnUnitInactive, but not
with OnActive)
On 05/11/2018 09:36, Andy Pieters wrote:
> Dear Systemd list
>
> I have got a job that I want to execute every other day.
>
> The job is rather lengthy and takes more than 24 hours to complete but
> less than 48.
>
> So here are my criteria:
>
> Start today
> Start the day after tomorrow (t+2d)*1
> Start the (t+2d)*2
> Start 2 days after that (t+2d)*n
>
>
> My timer unit:
>
> [Timer]
> OnCalendar=*-*-01,03,05,07,09,11,13,15,17,19,21,23,25,27,29,31 03:30:00
>
> The problem with that is when I simulate the execution dates,
> specifically at newyear:
>
> Tue 2018-12-25 03:30:00 CET
> Thu 2018-12-27 03:30:00 CET
> Sat 2018-12-29 03:30:00 CET
> Mon 2018-12-31 03:30:00 CET
> Tue 2019-01-01 03:30:00 CET
> Thu 2019-01-03 03:30:00 CET
> Sat 2019-01-05 03:30:00 CET
> Mon 2019-01-07 03:30:00 CET
> Wed 2019-01-09 03:30:00 CET
>
> We can see that the timer would be triggered two days in a row.
>
> What can we do about this, please? Is there a better way to define a
> timer to run every other day? Can we perhaps add an exception for a
> specific date?
>
> Thank you kindly
>
> Keep up the good work!
>
>
>
> Andy
> _______________________________________________
> systemd-devel mailing list
> systemd-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
SMILE <http://www.smile.eu/>
20 rue des Jardins
92600 Asnières-sur-Seine
*Jérémy ROSEN*
Architecte technique
Responsable de l'expertise Smile-ECS
email jeremy.rosen at smile.fr <mailto:jeremy.rosen at smile.fr>
phone +33141402967
url http://www.smile.eu
Twitter <https://twitter.com/GroupeSmile> Facebook
<https://www.facebook.com/smileopensource> LinkedIn
<https://www.linkedin.com/company/smile> Github
<https://github.com/Smile-SA>
Découvrez l’univers Smile, rendez-vous sur smile.eu
<http://smile.eu/?utm_source=signature&utm_medium=email&utm_campaign=signature>
eco Pour la planète, n'imprimez ce mail que si c'est nécessaire
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/systemd-devel/attachments/20181105/63ea88f9/attachment-0001.html>
More information about the systemd-devel
mailing list