GCP Cloud scheduler job run

Hi I have a cloud run job(not service) which i have to trigger every 4th week of the Month on Saturday and Sunday Night.

Cron job is not supporting the specific Week logic and  I dont want to unnecessary run the cloud run job every Saturday and sunday. I just need on 4th Week's (sat and sunday) . 

Can you please let me know what are suggested way to do this.

1 1 873
1 REPLY 1

Hello @gcloudLearning,

Cloud Scheduler utilizes the format based on unix-cron. It is not the most optimized way of setting schedules but it is the format used by Cloud Scheduler, then perhaps we can consider it as a current limitation of the product.

In helping with your case, I have found a workaround on how you can create a Cron job format for your specific query(Every 4th week of the month, every night of Saturday and Sunday):

0 12 23-29 * 6,0

  • 0 (minutes) - This is the frequency of minutes when the job is triggered. In this case, It is NOT triggered because its value is zero.
  • 12 (hour) - This is the frequency of hours when the job is triggered. I set this to 12 because in my timezone where it is +8:00 GMT, It is night time. Feel free to change this to align with your GMT.
  • 23-29 (day - month) - This is the days of the month when the job will be triggered. I chose 23-29 because this is where the 4th week of a month will most likely appear, along with the weekends.
  • * (month) - This is the frequency of months when it is triggered. In this case, It is triggered every month.
  • 6,0 (day - week) - This is the days of the week, 0 being sunday and 6 being saturday. 

You can refer to this documentation to know more about the rules of the Cron job format and time zone. Additionally, I used this website to forecast the next scheduled dates for your job. Feel free to change the time (12) and the range of the day of the month before the next schedule (23-29).

If the above option doesn't work, you can contact Google Cloud Support to further look into your case.

Let me know if it helped, thanks!

Top Labels in this Space