Date: Tue, 30 Sep 2003 19:07:43 +0100 From: Matthew Seaman <m.seaman@infracaninophile.co.uk> To: Odhiambo Washington <wash@wananchi.com>, Free BSD Questions list <freebsd-questions@freebsd.org> Subject: Re: complex crontab query Message-ID: <20030930180743.GA54438@happy-idiot-talk.infracaninophile.co.uk> In-Reply-To: <20030930164957.GL59342@ns2.wananchi.com> References: <20030930164957.GL59342@ns2.wananchi.com>
next in thread | previous in thread | raw e-mail | index | archive | help
--gKMricLos+KVdGMg Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Sep 30, 2003 at 07:49:57PM +0300, Odhiambo Washington wrote: > This question was asked and was answered by Crist J. Clark some years gon= e. > Google could not help me so I beg to ask here: crontab(5) should be all you need. =20 > I would like to run a script via crontab every >=20 > 1. 3rd day and 28th day of each month (seems easy) Crontab line like: 23 11 3,28 * * your_script will run at 11:23am on the 3rd and 28th of each month. > 2. Every first Thursday of the month This one is slightly trickier -- the best you can do with crontab is either every Thursday, and add logic to your script to detect if it's on or before the 7th of the month (or conversely for the first 7 days of each month, and have the script check if it's Thursday): something like -- 23 11 * * Thu [ $(date +%d) -lt 8 ] && your_script ( or 23 11 1-7 * * [ $(date +%a) =3D "Thu" ] && your_script but the former is probably preferable) Cheers, Matthew=20 --=20 Dr Matthew J Seaman MA, D.Phil. 26 The Paddocks Savill Way PGP: http://www.infracaninophile.co.uk/pgpkey Marlow Tel: +44 1628 476614 Bucks., SL7 1TH UK --gKMricLos+KVdGMg Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.3 (FreeBSD) iD4DBQE/ecZvdtESqEQa7a0RAhBBAJdYcKCx7F5vGirur/g6tWiNATprAJ97MXVE BH0tAJM7KDnou3hzLQ7mLQ== =7vdR -----END PGP SIGNATURE----- --gKMricLos+KVdGMg--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20030930180743.GA54438>