[CentOS] run script on cron job only run on first Saturdat every month???

Gordon Messmer gordon.messmer at gmail.com
Mon Aug 5 07:00:45 UTC 2013


On 08/04/2013 10:17 PM, zGreenfelder wrote:
> or... if it really has to be on the first Saturday and only on the first
> Saturday,
> then running something like
> 15 4 1-7 * *  /home/app/oracle/backup/monthlybk.sh
>
> with the top of the monthlybk.sh script doing soemthing like

No, really.  We went over this.  You don't have to modify your scripts. 
  You can put the "test" in the crontab.  John's example should work 
properly:

15 04 * * 6    test $(date +"%d") -le 07 && 
/home/app/oracle/backup/monthlybk.sh

Cron will run those commands every Saturday.  On the first Saturday in 
the month, "test" will succeed and the script will be run.




More information about the CentOS mailing list