[ILUG] cron job on the first weekend of the month

Niall O Broin niall at linux.ie
Fri Apr 26 19:28:56 IST 2002


On Fri, Apr 26, 2002 at 06:06:22PM +0100, Garret.OKelly at beaumont.ie wrote:

> Anyone got any ideas  how I might schedule a cronjob to run on the first 
> weekend of the month
> 
> Say to run the job on the first Saturday, whatever date it might be, I was 
> hoping I could do like:
> 
> 00 3 1-8 * * 6 abc.sh
> 
> to AND the 'day of the month' and 'day of the week' fields, but cron seems 
> to OR them so that this'd run for the first 8 days, plus each sat morning 
> after that.

This has been asked here before, I'm sure. You can't do it directly with
cron - just run a script every saturday like this:


#!/bin/bash
if [ `date +%d` -lt 1 ]; then
   echo Doing first Saturday stuff now
fi



Niall




More information about the ILUG mailing list