Thinking about when our crontab entries run
It's clock change time tonight in Canada, so naturally when our crontab entries run is a little bit on my mind. This has led me to realize that almost all of our system crontab entries can be divided into two broad types.
The first sort of crontab entry is one that we want to run periodically at some interval (roughly, it doesn't have to be exact, especially for the longer intervals). We have ones that run every minute, every other minute, every five, ten, or fifteen minutes, every hour, and 'a few times a day'. These crontab entries mostly care about the elapsed time since the last time they ran; what the clock on the wall says is pretty irrelevant.
The second sort of crontab entries is that we want to run once a day or once a week at some time during low usage hours. When exactly these entries run during that time isn't all that important (we don't really care if it runs at midnight, 3am, or 6am), and so we often take the system defaults for 'once a day' timing. When we explicitly schedule these (usually because they want to run as a non-root user), we naturally avoid the 1am to 2am time change danger zone.
(I sometimes do wish all of our systems could agree on the 'once a day' time, and perhaps have it very close to midnight for the convenience of rolling logs. Having your daily logs run from roughly 6am one day to roughly 6am the next day does have its little drawbacks and discontents.)
We have a certain number of crontab entries that we want to run at specific times. Some of these times are based on work hours (for example, for making regular ZFS snapshots of some filesystems), and some times are chosen to be out of work hours but not too late (for when we start backups). There's generally some flexibility in when exactly we run the crontab, but they're fundamentally not in the 'once a day, when convenient' bucket because they have additional constraints.
I'm sure there are environments where system crontab entries need to run at specific narrow times dictated by business needs and other external events. We're just lucky enough to not be in one.
(We don't have any 'once a month' system crontab entries, although our Ubuntu machines have some of their own.)
Comments on this page:Written on 06 November 2021.