Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!decwrl!ucbvax!iwarp.intel.com!news From: merlyn@iwarp.intel.com (Randal Schwartz) Newsgroups: comp.unix.wizards Subject: Re: Cron - First Saturday of the month Message-ID: <1990Aug10.063819.5253@iwarp.intel.com> Date: 10 Aug 90 06:38:19 GMT References: <19744@orstcs.CS.ORST.EDU> <1990Aug8.185745.16606@iwarp.intel.com> <1990Aug8.214539.1264@watserv1.waterloo.edu> <1990Aug9.001850.19494@iwarp.intel.com> <1990Aug10.040654.17334@watserv1.waterloo.edu> Sender: news@iwarp.intel.com Reply-To: merlyn@iwarp.intel.com (Randal Schwartz) Organization: Stonehenge; netaccess via Intel, Beaverton, Oregon, USA Lines: 69 In-Reply-To: dmcanzi@watserv1.waterloo.edu (David Canzi) In article <1990Aug10.040654.17334@watserv1.waterloo.edu>, dmcanzi@watserv1 (David Canzi) writes: | In the absence of source code, you experiment. At 23:32 on Thursday, | Aug 9, these were the contents of my crontab: | | 32 23 1-5 * 1 date > /u/dmcanzi/temp/www | 32 23 7-11 * 4 date > /u/dmcanzi/temp/xxx | 32 23 1-5 * 4 date > /u/dmcanzi/temp/yyy | 32 23 7-11 * 1 date > /u/dmcanzi/temp/zzz | | The files xxx, yyy, and zzz were created, www was not created. The | manual page is correct. See, but now that makes cron non-orthogonal. Yuck. So, without looking at the source, I have to second-guess the logic. Is it: minutes-match AND hours-match AND (days-match OR dow-match) AND months-match (meaning 0 0 1 7 1 would run on the first of June and all Mondays in June) or: minutes-match AND hours-match AND ((days-match AND months-match) OR dow-match) (meaning 0 0 1 7 1 would run on the first of June and all Mondays in any month) or: some-other-combination-that-I-didn't-type-in Either way, throwing that OR in there means the manpage is incomplete. (And cron is hard to inuitively guess now.) Putting it another way, I could not work from the manpage and build a cron that is guaranteed to work the same way as out-of-the-box cron. Don't have a POSIX spec in front of me. What do they say about this ambiguity? By the way, cron logic like this is backwards. You can always get OR logic by duplicating the entries. To get AND logic, you have to have something *in* the command make an additional decision. And, continuing on with my tirade, since it says earlier in the manpage "if a field is an asterisk character (*) it means that the job is done for all possible values of the field", that would make me believe that: 0 0 * * 1 would work the same as: 0 0 1-31 * 1 which is not true. (The first executes 4 times a month, the second 31 times a month [more or less]). This (now incorrect) intuition follows from noticing that: * 0 * * * is the same as: 0-59 0 * * * So, they really mucked up when they OR-ed in that day-of-week field. Sigh. Sorry. I'll crawl under my rock now. Cron's only for the heavyweights, anyway. Just another UNIX hacker, -- /=Randal L. Schwartz, Stonehenge Consulting Services (503)777-0095 ==========\ | on contract to Intel's iWarp project, Beaverton, Oregon, USA, Sol III | | merlyn@iwarp.intel.com ...!any-MX-mailer-like-uunet!iwarp.intel.com!merlyn | \=Cute Quote: "Welcome to Portland, Oregon, home of the California Raisins!"=/