Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 7 Oct 2003 17:53:47 +0300
From:      Odhiambo Washington <wash@wananchi.com>
To:        Free BSD Questions list <freebsd-questions@freebsd.org>
Subject:   Re: complex crontab query
Message-ID:  <20031007145347.GB49707@ns2.wananchi.com>
In-Reply-To: <20030930180743.GA54438@happy-idiot-talk.infracaninophile.co.uk>
References:  <20030930164957.GL59342@ns2.wananchi.com> <20030930180743.GA54438@happy-idiot-talk.infracaninophile.co.uk>

next in thread | previous in thread | raw e-mail | index | archive | help

--IS0zKkzwUGydFO0o
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

* Matthew Seaman <m.seaman@infracaninophile.co.uk> [20030930 21:08]: wrote:
> 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 g=
one.
> > Google could not help me so I beg to ask here:
>=20
> 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)
>=20
> Crontab line like:
>=20
>   23 11 3,28 * * your_script
>=20
> will run at 11:23am on the 3rd and 28th of each month.
>=20
> > 2. Every first Thursday of the month
>=20
> 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 --
>=20
>   23 11 * * Thu   [ $(date +%d) -lt 8 ] && your_script
>=20
> ( or
>=20
>   23 11 1-7 * *   [ $(date +%a) =3D "Thu" ] && your_script
>=20
> but the former is probably preferable)

How does that differ with the following?

23 11 * * 4     if [ `date +\%d` -le 7 ]; then /path/to/my/command; fi



=20

        Best regards,
        Odhiambo Washington
        Wananchi Online Ltd.

----------------------------------+-----------------------------------------
 Odhiambo W. wash(at)wananchi(dot)com	. WANANCHI ONLINE LTD (Nairobi, KE)
 http://www.wananchi.com/email/		. 1ere Etage, Loita Hse, Loita St.,
 Mobile: (+254) 722 743 223		. # 10286, 00100 NAIROBI
----------------------------------+-----------------------------------------
What the hell, go ahead and put all your eggs in one basket.
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++


Do not be afraid of those who kill the body but cannot kill the soul.
Rather be afraid of the One who can destroy both soul and body in hell.
        Matthew 10:28
    =20


--IS0zKkzwUGydFO0o
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (FreeBSD)

iD8DBQE/gtN7n7LIsuxjem8RAuVDAJ424cMdCCEWAWS19XrkKt/eYLc3/wCfYlzF
RRuYCWHhLY+gybwsN61idtM=
=PApf
-----END PGP SIGNATURE-----

--IS0zKkzwUGydFO0o--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20031007145347.GB49707>