Check on specific day of month #785
Loading…
x
Reference in New Issue
Block a user
No description provided.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What I'd like to do and why
I'd like the ability to specify to specify check frequencies based not on when the last check was done, but based on the calendar. This would not replace the current frequency system, rather, it would be an alternative, perhaps specified with a different key (e.g.,
schedule
instead offrequency
.)Examples
The 1st/2nd/etc. day of every month
It should be possible to select multiple of these. For example, "every 1st and 15th day of the month" for something like "2 weeks" but something you can actually plan on
The 1st/2nd/etc. Monday/Tuesday/etc. of each month.
Like with the last option, you should be able to choose multiple of these, so, like, "every 1st and 3rd Monday." It would also be nice, although not necessary or my use case, to be able to say stuff like "the 1st Monday and the 3rd Wednesday."
Every Monday/Tuesday/etc., not of each month, but just in absolute terms.
You should also be able to choose stuff like "every other Saturday" or "every third Friday." Also, you should be able to do something like "Every Monday and every Thursday."
Other aspects/concerns
frequency
or this new feature when configuring when checks run. It would be confusing to combine "1 week" frequency and "every other Monday" scheduling, after all.The motivations for this request
Thank you for considering.
Other notes / implementation ideas
No response
First of all, thanks for taking the time to file such a detailed ticket. It's especially helpful to see the motivations so I can really understand your use case.
My first thought is that because borgmatic isn't a daemon like cron, it can't really make guarantees around when it's run. And you do mention this above in your section about missed checks. But this "feature" of borgmatic makes me wonder if allowing the sort of precise scheduling you've described would be a little misleading for the user. It's suggesting to them that they can request checks on, say, the 1st and 3rd Monday of the month, but borgmatic can only do best effort scheduling towards that.
So I actually have a different proposal that I hope solves your core need while still leaning on the existing
frequency
mechanism.. I feel like a simplefrequency
is much more "honest" to the user in that it telegraphs that the scheduling is only best effort. So in that spirit, what do you think of a configuration something like this?Semantically, this would mean that checks run every 2 weeks but only on Saturday or Sunday. So if the 2 week "timer" expired on a Thursday, for instance, the check wouldn't run until two days later on Saturday. I could also see supporting
weekday
orweekend
as values indays_of_week
.In practice, I think this would mean that similarly configured checks would tend to get aligned naturally. (Although maybe in practice, some would run on the 1st and 3rd Saturday and some on the 2nd and 4th.)
Would the day of week restriction sufficiently solve that, even if it's not perfect? Or do you actually need them to run at particular points in the month (1st Thursday, etc.)? You might also consider cron/systemd for this need. I'm open to expanding borgmatic's scheduling functionality, but if you need really precise scheduling, a real scheduler may be a better bet.
I definitely tried to be considerate of that, but knew that I wouldn't be able to fully reconcile the tension here. I mean, it's kind of already like that already (you might say to run some check every week, but then, due to missed
borgmatic
runs, it ends up taking more than a week for the check to occur.) But, of course asking for specific dates does up the expectations that things would occur on certain days. I'd yield to your experience dealing with questions from users when it comes to design that reduces the number of questions you'd get.Your suggestion seems good to me aesthetically and I believe it conveys some implicit information about what to expect. It would suit my needs, and, like you said:
For those who really need super precise scheduling, separating the checks from the backups into their own jobs orchestrated by whatever one's OS provides is, although less convenient to implement as a user, going to cover the gaps for just about anyone. So I'm fine with designs that don't try to solve everything, knowing that people can always fall back to these workarounds, in exchange for being more elegant within their own scope.
Personally, the answer to this is mostly "no, I don't need them at particular points in the month." Rather, I anticipated that I might need to specifically avoid certain days of the month, but I didn't want to expand the scope of my request to include blacklisting, cuz that's a whole can of worms that can be worked around by just specifying days besides the ones to avoid. I worded my request with the potential needs of business users in mind, as they're more likely to have scheduled times when maintenance occurs that they can communicate with their customers. Basically, I didn't want to let my personal home use of borgmatic overly influence the design of the feature.
With that said,
Yes, for me it would. I personally would prefer to run these long checks on weekends, when not being able to access the data (because, when a check finishes running, the next backup will start and I need to not have those files open during that time) will not be as disruptive to me personally. I suspect other home users will prefer weekdays over weekends for similar reasons.
So, tl;dr, I like your proposed solution. Let's go with it.
Sounds good! I appreciate your flexibility here. I think we can always iterate and expand the feature in the future as more users weigh in. And if some of those hypothetical business users need blacklisting, then we can always consider it then!
Implemented in main and will be part of the next release! I ended up calling this option
only_run_on
and the docs will be live here shortly: https://torsion.org/borgmatic/docs/how-to/deal-with-very-large-backups/#check-daysReleased in borgmatic 1.8.13!