Re: [PATCH] maintenance: use systemd timers on Linux
- From
Ævar Arnfjörð Bjarmason <avarab@gmail.com>
- Date
- May 5, 2021, 12:01 UTC
- Message-ID
- <871ralwfo8.fsf@evledraar.gmail.com>
- In-Reply-To
- <CAPig+cQks0_nL1J4YUbEUjmWYLKrhuHX-f8PkWM2zFE4gybWMw@mail.gmail.com>
On Sun, May 02 2021, Eric Sunshine wrote:
Show 20 quoted lines
> On Sat, May 1, 2021 at 10:59 AM Lénaïc Huard <lenaic@lhuard.fr> wrote:
>> + strvec_push(&child.args, "--now");
>> + strvec_pushf(&child.args, "git-maintenance@%s.timer", frequency);
>> +
>> + if (start_command(&child))
>> + die(_("failed to run systemctl"));
>> + return finish_command(&child);
>> +}
>> +static int systemd_timer_write_unit_templates(const char *exec_path)
>> +{
>> + unit = "[Unit]\n"
>> + "Description=Optimize Git repositories data\n"
>> + "\n"
>> + "[Service]\n"
>> + "Type=oneshot\n"
>> + "ExecStart=\"%1$s/git\" --exec-path=\"%1$s\" for-each-repo --config=maintenance.repo maintenance run --schedule=%%i\n"
>
> I see that it's in POSIX, but do we use this `%n$s` directive
> elsewhere in the Git source code? If not, I'd be cautious of
> introducing it here. Maybe it's better to just use plain `%s` twice...We use it in po/, so for sprintf() on systems that don't have NO_GETTEXT=Y we already test it in the wild.
But no, I don't think anything in the main source uses it, FWIW I have a WIP series in my own fork that I've cooked for a while that uses this, I haven't run into any issues with it in either GitHub's CI (e.g. Windows), or on the systems I myself test on.
I think it would be a useful canary to just take a change like this, we can always change it to the form you suggest if it doesn't work out.