Date: Tue, 10 Oct 2000 19:48:00 -0500 (CDT) From: Mike Meyer <mwm@mired.org> To: tara@exit1.com Cc: questions@freebsd.org Subject: Re: Cronjob help Message-ID: <14819.47296.76174.812561@guru.mired.org> In-Reply-To: <66200254@toto.iv>
next in thread | previous in thread | raw e-mail | index | archive | help
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 "/<number>" 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. <mike To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?14819.47296.76174.812561>