Reputation: 2896
How to config a cron job to run every 5 minutes between 9:00am~20:00pm, but every 10 minutes in other time of the day.
Upvotes: 0
Views: 515
Reputation: 4510
The new API for cron now can do it. Please check the document at: https://cloud.google.com/appengine/docs/python/config/cron#Python_app_yaml_The_schedule_format
every 12 hours
every 5 minutes from 10:00 to 14:00
every day 00:00
every monday 09:00
2nd,third mon,wed,thu of march 17:00
1st monday of sep,oct,nov 17:00
1 of jan,april,july,oct 00:00
Upvotes: 0
Reputation: 881863
I would recommend just using every 5 minutes synchronized
in the cron.yaml, and then just terminate immediately in the handler if the exact time is not to your liking (hour before 9 or after 20 and minute // 5
is odd, for example). GAE's cron
is not very sophisticated, but running a trivial handler which just gets the time, checks whether that's OK, and terminates immediately otherwise, is pretty simple and cheap (and the 70 or so "extra hits per day", each with a trivial amount of resource consumption, will hardly make a difference to your app's overall resource consumption anyway).
Upvotes: 3