如何在Google App Engine cron.yaml的营业时间运行cron作业? [英] How to make a cron job run during business hours on Google App Engine cron.yaml?
问题描述
我已经阅读过文档,但我正在摸索如何做到这一点。我想在工作时间运行cron作业。所以我的cron.yaml看起来像这样:
cron:
- description:我的酷Cron作业
url:/myCoolCronJob.php
时间表:每周一,周二,周三,周四,周五06:00至19:00每5分钟
时区:America / Los_Angeles
显然这不起作用。但它应该让你知道我想做什么。我如何在工作时间让这个cron作业运行?
日程安排格式不提供高频率
每N(小时|分钟|分钟)[从(时间)到(时间)]
和低频率
(every| ordinal) (days)[of(monthspec)](time)
获得你想要的东西的方式是: 在 检查cron作业本身的周日情况,如果执行的日期是星期六或星期日,则在开始和结束时不做任何事情。
cron.yaml $ c中配置计划的高频部分$ c>:
计划:每6分钟从06:00至19:00
I've read the docs, but I'm scratching my head on how to do this. I want to run a cron job during business hours. So my cron.yaml would look something like:
cron:
- description: My Cool Cron Job
url: /myCoolCronJob.php
schedule: every 5 minutes from 06:00 to 19:00 every monday, tuesday, wednesday, thursday, friday
timezone: America/Los_Angeles
That doesn't work, obviously. But it should give you an idea of what I want to do. How can I make this cron job run during business hours?
The Schedule format doesn't offer a combination between the high-frequency
every N (hours|mins|minutes) ["from" (time) "to" (time)]
and the low frequency
("every"|ordinal) (days) ["of" (monthspec)] (time)
The way to obtain what you desire is to:
configure the high frequency portion of the schedule in
cron.yaml
:schedule: every 5 minutes from 06:00 to 19:00
check the weekday condition inside the cron job itself, at the beginning and exiting without doing anything if the day of execution is Saturday or Sunday.
这篇关于如何在Google App Engine cron.yaml的营业时间运行cron作业?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!