开发者

Schedule a cron job for execution every hour on certain days on App Engine

I would like to schedule a cron task to run every hour, but only from Thursday through Monday. Is a schedule like this possible? From the documentation, it looks like I can schedule a cron task to run at an hourly interval or on specific days at a single specific time, but I cannot figure out how to schedule a cron task to run at an hourly interval only on specific days.

I've tried schedules like the following in cron.yaml:

  • every 1 hours thu,fri,sat,sun,mon
  • every 1 hours of thu,fri,sat,sun,mon

The way I read the documentation, I think this may be impossible. I'm hoping that I've either missed something or th开发者_开发百科at there is some undocumented syntax for what I'm trying to accomplish.


Like you noticed in the documentation for cronjobs, the source also seems to indicate that the interval schedule format doesn't let you restrict the interval to particular day(s) of the week.

Though you can't schedule your task with a single cronjob, you could schedule it with multiple cronjobs:

every thu,fri,sat,sun,mon 00:00
every thu,fri,sat,sun,mon 01:00
...
every thu,fri,sat,sun,mon 23:00

Alternatively, leoluk's comment makes a good suggestion - just use a single, simple interval schedule which invokes your script every hour, but have your script terminate without doing anything if the day of week is one which you wish to exclude (e.g., Tuesday or Wednesday in your case).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜