From owner-freebsd-questions Tue Oct 10 17:48: 3 2000 Delivered-To: freebsd-questions@freebsd.org Received: from guru.mired.org (okc-27-149-77.mmcable.com [24.27.149.77]) by hub.freebsd.org (Postfix) with SMTP id 308B637B66C for ; Tue, 10 Oct 2000 17:48:01 -0700 (PDT) Received: (qmail 62167 invoked by uid 100); 11 Oct 2000 00:48:00 -0000 From: Mike Meyer MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <14819.47296.76174.812561@guru.mired.org> Date: Tue, 10 Oct 2000 19:48:00 -0500 (CDT) To: tara@exit1.com Cc: questions@freebsd.org Subject: Re: Cronjob help In-Reply-To: <66200254@toto.iv> X-Mailer: VM 6.72 under 21.1 (patch 10) "Capitol Reef" XEmacs Lucid X-face: "5Mnwy%?j>IIV\)A=):rjWL~NB2aH[}Yq8Z=u~vJ`"(,&SiLvbbz2W`;h9L,Yg`+vb1>RG% *h+%X^n0EZd>TM8_IB;a8F?(Fb"lw'IgCoyM.[Lg#r\ Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG tara@exit1.com writes: > I have read the documentation on setting up a cron job to run every > other Wednesday - I did exactly what the documentation stated - here is > my entry in /etc/crontab: > > #Capitolworks script > 30 12 * * mon/2 root > /usr/home/politemps/capitolworks/newsletter.pl > However - the script runs every monday - does anyone know what is > wrong...I sure don't get it. mon??? That's going to make it run on Mondays. "wed" to get it to run on Wednesdays. The "/" is used with ranges (and "*", which is a range) to get it to skip elements of the range. You could use "*/2" to mean "every Sunday,Tuesday,Thursday,Saturday" - at least that's what I'd expect. Every other wednesday is a particularly painful one to catch. Twice a month would be easy (30 12 1,15 * * ...). To get what you want, I'd suggest having your script touch a file indicating that it finished properly after it does so (assuming you don't already), and when it starts making sure the file is at least 10 days old - or doesn't exist. Then run the script every Wednesday (30 12 * * wed...) and let it not do anything every other one. As a final note, you might want to investigate the "crontab" command, which lets individual users run scripts - including root - instead of tweaking /etc/crontab. That way you can upgrade /etc/crontab with the system without having to worry about your own things. You can also look into making someone other than root run this script.