2012/11/12

Vixie is a smart guy

I found out something interesting the other day. A crontab entry has a DOW (day of week) column and a day of month (DOM) column. Because I'm a bad sysadmin, I'd never read the full manpage and assumed that if you specified both your entry would be run once every 7 or 14 years. I also suffer from NIH, so I'm writing a cron replacement in pure-perl that includes all the stuff I think a cron should have, like watching a directory for new files. So I finally read the full man page. And it turns out that Vixie was a smart guy. Having an cron job that runs every 7 or 14 years isn't useful so the DOW and DOM columns don't affect each other.

I other words

0 0 1 * 0 do-something
is in fact the equivalent of
0 0 1 * * do-something
0 0 * * 0 do-something
which is so much more useful.

This is another formulation of the "don't allow the user to do stupid things" principle I talked about a while back.

No comments: