Re: [PATCH] maintenance: use systemd timers on Linux
flat view
From: Eric Sunshine <hidden>
Date: 2021-05-02 06:49:31
On Sun, May 2, 2021 at 1:28 AM Bagas Sanjaya [off-list ref] wrote:
On 01/05/21 21.52, Lénaïc Huard wrote:quoted
The existing mechanism for scheduling background maintenance is done through cron. On Linux systems managed by systemd, systemd provides an alternative to schedule recurring tasks: systemd timers. The main motivations to implement systemd timers in addition to cron are: * cron is optional and Linux systems running systemd might not have it installed.Supposed that I have Linux box with systemd and classical cron. Should systemd timers be preferred over cron?
The implementation in this patch unconditionally prefers `systemd` over `cron`. Whether that's a good idea is subject to question (as both brian and I mentioned in our reviews).
Nevertheless, because we are dealing with external dependency (systemd), it should makes sense to enforce this dependency requirement when user choose to use systemd timers so that users on non-systemd boxes (such as Gentoo with OpenRC) don't see errors that forcing them to use systemd.
If you scan through the patch itself, you will find that it is careful to choose the appropriate scheduler and not to spit out errors when one or the other scheduler is unavailable.