Path: utzoo!utgpu!news-server.csri.toronto.edu!clyde.concordia.ca!uunet!pilchuck!amc-gw!thebes!happym!irv From: irv@happym.wa.com (Irving [h] Wolfe) Newsgroups: comp.sources.d Subject: Re: First monday of the month (was Re: v23i028: A cron/crontab replacement, Part01/01) Message-ID: <882@happym.wa.com> Date: 15 Oct 90 02:29:30 GMT References: <2878@litchi.bbn.com> <49594@olivea.atc.olivetti.com> <8083@gollum.twg.com> <1990Oct14.065042.16216@iwarp.intel.com> Organization: Happy Man Corp., Seattle Lines: 25 In <1990Oct14.065042.16216@iwarp.intel.com> merlyn@iwarp.intel.com (Randal Schwartz) writes: >In article <8083@gollum.twg.com>, david@twg (David S. Herron) writes: >| surprised that cron was unable to do this "cleanly", >| was to have a job run on (for instance): >| the first monday of the month >The answer is that an unbroken cron (one more or less derived from V7) >can do this easily with: >10 3 1-7 * 1 some-command some-parameter >However, later versions of cron are broken Okay, sure, they're broken. The current way isn't as smart as the older way (and by the way [wink], thanks for the history lesson, Randal). But it is still easy enough to do by having the crontab line use the date command inside an if. It's "inelegant" and harder to read, but big deal, the general answer does exist: 52 8 * * 1 if [ `date +\%d` -ge 21 -a `date +\%d` -le 27 ] ; then echo "Subject: green RECYCLE out Tuesday morn\n" | smail opmgr ofcasst >/dev/null ; fi -- Irving Wolfe Happy Man Corp. irv@happym.wa.com 206/463-9399 ext.101 4410 SW Point Robinson Road, Vashon Island, WA 98070-7399 fax ext.116 SOLID VALUE, the investment letter for Benj. Graham's intelligent investors