On Mon, Dec 13, 2021 at 4:42 PM Michael Orlitzky <m...@gentoo.org> wrote: > > On Mon, 2021-12-13 at 22:38 +0100, Frank Steinmetzger wrote: > > > > Well I *could* disable run-crons altogether and add entries to fcron’s own > > crontab which would run those scripts in /etc/cron.{hourly,daily,...} > > instead. > > > > However, I like predictable times at which those jobs will run. Especially > > if one of them is a zfs scrub; the NAS is powered down for weeks, sometimes > > months. And when I power it up, it’s for a reason. And that reason usually > > is not a scrub, which—at the current zfs fill level—takes 10½ hours. > > > > Why choose fcron then? It sounds like you have the same rationale as I > do: "no, I don't want to run the 4am backup job in the middle of the > business day just because it wasn't run at 4am." > > If you pick a dumber cron, the crontab entries are run only at the > specified times.
There really are no one-size-fits all solutions obviously. You can either have predictable times and if the machine is down things get skipped, or you can run opportunistically in which case you lose predictable times at least until the machine goes back to running 24x7. The machine has no way to know if you'll leave it on overnight the NEXT night - only if you did so the one before. fcron is perfectly capable of running jobs at either set times or at loosely-defined intervals that are compensated for if the machine is off. Systemd timers can also be set that way, and can also have limits put on scheduling (daily nominally at 3AM but allowed between 11PM and 5AM or whatever). Obviously the more expressive the crontab equivalent is, the more you can tweak it to do what you want it to. The default configs are a one-size-fits all approach that tend to do the right thing if you leave the machine on 24x7, or if you run it at random times. If you want to specify exact behavior just edit the config files and make it do so. I'll also note that zfs scrubs checkpoint at shutdown and will auto-resume where you leave off. If they are involved multiple times with the default options I think any attempt to scrub something that is already being scrubbed is just a no-op. Obviously if you don't want all that IO during the day you'll have to do something more clever - you can instruct it to pause and resume so you could have a couple of crontab entries and scripts to do just that. -- Rich