norm@ames.arc.nasa.gov (Norm Finn) (05/09/89)
Ed Arnold's question about 4.0.1 running his crontab entries twice prompted this submission. The good news is that 4.0.1's cron facility supports multiple users, each with his/her own crontab, and returns any output from the jobs via mail. The bad news is that they switched to SysV semantics for interpreting the day-of-month and day-of-week fields in the crontab files. We had the following entries to perform disk maintenance on the first Monday of the month (dumonthly), all other Mondays (duweekly) and all other weekdays (dudaily): 45 4 1-7 * 1 /usr/local/bin/dumonthly 45 4 8-31 * 1 /usr/local/bin/duweekly 45 4 * * 2-5 /usr/local/bin/dudaily Under rev 3.3, dumonthly ran at 4:45 when the day-of-month (1-7) AND the day-of-week (1) BOTH matched, which is the first Monday of the month. Duweekly ran on all other Mondays (day-of-month in range 8-31 AND day-of-week = 1). Dudaily ran on any day of the month (*) that was a Tuesday through Friday (2-5). Under rev 4.0.1, as documented in the crontab(5) man page and textbooks on SysV and as observed in action, this has been changed. Now, the OR is taken of the day-of-month and day-of-week fields. Duweekly now runs on every day that is a Monday OR is in the range 8-31. On Wednesday, 12 April, both duweekly (8-31 was satisfied) and dudaily (2-5 was satisfied) were run. The net result is a reduction in functionality, since the Berkeley rules can give the same results as SysV by fiddling with and adding more crontab lines, while the SysV rules cannot perform the perfectly reasonable scheduling we were enjoying under 3.5. (Really. I've gone through some good examples I won't bore you with. Think about it before you flame me.) We now have to run the kludge: 30 4 1 * * /usr/bin/touch /home/usr2/norm/size.trigger 45 4 * * 2-5 /usr/local/bin/dudaily / /home/usr2/norm/size 1024 45 4 * * 1 /usr/local/bin/duweekly / /home/usr2/norm/size 1024 Duweekly now checks for the presence of size.trigger, then deletes it and calls dumonthly if the trigger file is present. It's unfortunate that we have to retrogress from what is essentially a bug fix to SysV's (mal)functionality, but I'm afraid that this kind of annoyance is the price of compatibility. Norm Finn domain: norm@ultra.com Ultra Network Technologies Internet: ultra!norm@ames.arc.nasa.gov 101 Daggett Dr. uucp: ...ames!ultra!norm San Jose, CA 95134 (408) 922-0100