Search code examples
crongoogle-cloud-scheduler

Google App Engine cron job schedule repeat on days with DST changes


I have a cron job that should repeat every 3 hours and must land on 9:30 in US/NY time.

If I start the job at 0:30, and run it every 3 hours, will it run at 9:30 on daylight savings days?

The documentation is a bit vague on this: https://cloud.google.com/scheduler/docs/configuring/cron-job-schedules#daylight_savings_time. It uses wall clock time to start, but does it use wall-clock time for each offset as well?

Alternatively, could I start it using 9:30 as the trigger time, and then every 3 hours until 6:30am the next day?


Solution

  • As you mentioned, Cloud scheduler uses wall clock time, is expected that the executions changes according the wall time.

    To run a job from 9:30am to 6:30am (next day) you need 2 Scheduler jobs

    1st will be run every 3 hours starting 9:30 to 23:30

    30 9/3 * * *
    

    2nd will be run every 3 hours starting 0:30 to 6:30

    30 0-6/3 * * *
    

    I use this page when I have doubts about cron format