Cron run script on first Saturday of month and 3 days before

Hello all,
I know that the following will run the user defined script on the first Saturday of the month every 3 minutes after the hour from 8 -5; But is there a way to cause the script to execute for the prior three days before the first Saturday?
If the Saturday coincides with the 4th through the 7th it's reasonably easy, but when the Saturday happens on the First of the month?
Here is a sample created to run script on day 3..5 of month, but like to execute script on 28-30 of previous month if Saturday happens on the 1st.

03 08-17 3-5 * * [ $(date +\%d) -le 06 ] && /run/your/script

Any expert advice appreciated:

It will become very complex one-liner, hard to understand and modify in the future. Why not calling the script every day at the time needed and the whole logic if the script should do something or exit immediately to be done at the beginning of your script. There you can use the most complicated logic you may need and it will be well visible on several lines with proper comments.

Welcome @axm1955 !

Yes, and the days can be restricted to Wed...Fri, right?
So the crontab schedule is

03  08-17  *  *  3-5

The "three days before the first Saturday" is to be done by a computation.
Do you have GNU date (Linux)?
Then it can be a simple

[ $(date -d "next Saturday" +\%d) -le 07 ] && /run/your/script

Forgive the denseness of thinking, but expanded crontab are not my strong suit, could you please share more? Not getting it, sry.

I don't understand how that would make the script execute on say WEd-Thu of say previous month if Saturday landed on the 1st.

The 3-5 in the schedule is every Wed,Thu,Fri

Then the date -d "next Saturday" +\%d gives the day (1..31) of the following Saturday, if <= 7 it's the first Saturday.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.