Search code examples
google-cloud-platformgoogle-cloud-scheduler

Google Cloud Scheduler trigger last day of month


I want to create a trigger in Google Cloud Scheduler that runs at 9am on the 25th and the last day of each month (depending of the month that would be 28, 30, or 31th).

I assumed somethink like this might work, but GCP does not understand the L-syntax:
0 9 25,L * *

Any (elegant) ideas how to do it without having multiple triggers?


Solution

  • One trigger, with minimized overhead calls:

    0 0 25,28-31 * *

    Then, inside the function:

    IF is25() OR islastDayOfMonthHelper()
      work
    ELSE 
      return