Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

batou_ext.cron.SystemdTimer: Allow to supply multiple onCalendar expressions #126

Open
tritum opened this issue Aug 11, 2023 · 0 comments
Open

Comments

@tritum
Copy link

tritum commented Aug 11, 2023

Systemd allows to supply timers with multiple values for OnCalendar. This will trigger the service every time any timer matches. The SystemdTimer class does, however, only supports supplying a single string value.

NixOS seems to be able to handle multiple timer units. Local testing suggests that supplying a list should be able to generate a valid systemd timer:

systemd.timers.test_timer = {
    # …
    timerConfig.OnCalendar = ["*-*-01 01:00:00" "*-*-2 02:00:00"];
}
# …

[Timer]
OnCalendar=*-*-01 01:00:00
OnCalendar=*-*-02 02:00:00

An alternative would be to create multiple timers/services doing the same thing. But as each timer
is marked as Persistent, my understanding is that such jobs could be triggered multiple times after a system failure.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant