Date: Tue, 15 Apr 1997 18:55:25 -0700 (PDT) From: Alex Belits <abelits@phobos.illtel.denver.co.us> To: Shawn Carey <smc@servtech.com> Cc: "Daniel O'Callaghan" <danny@panda.hilink.com.au>, freebsd-hackers@freebsd.org Subject: Re: crontab question Message-ID: <Pine.LNX.3.95.970415175333.9632B-100000@phobos.illtel.denver.co.us> In-Reply-To: <3354143F.41C67EA6@servtech.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, 15 Apr 1997, Shawn Carey wrote: > > 0 14 1-7 * 0 root mail -s "cron test" root > > will run on the first Sunday. > > [...] > > But won't it run every day of the first week, and every Sunday after > that also? > Only one of the two day fields needs to match in order for cron to run > the command. Since I'll be using this to automate monthly backups, I'd > rather not accidentally chew on tapes that happen to be in the drives at > an unlucky moment! :-) > > It seems to me that what I need is for cron to logically AND the > day-of-week and day-of-month fields instead of using logical OR. Is > there any low down, dirty way to simulate this (short of hacking cron)? 0 14 1-7 * * root date | grep Sun >/dev/null && mail -s "cron test" root and last Sunday: 0 14 22-31 * * root [ `date|cut -f3 -d' '` = `cal|cut -f1 -d' '|grep -v ^\$|tail -1` ] && mail -s "cron test" root -- Alex
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.LNX.3.95.970415175333.9632B-100000>