views:

25

answers:

1

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.

+3  A: 

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).

Alex Martelli
thanks Alex, just terminate the process out of 9:00am~20:00pm works for me.
leon
and as you see, the storage api call is very heavy. so now I choice to do all the dirty stuff in the memcache, then run a separate cron job to collect the statistics data and push them in to the storage.
leon