【问题标题】:How to set up python cron job in app engine from september to may如何从 9 月到 5 月在 app 引擎中设置 python cron 作业
【发布时间】:2014-06-09 01:40:30
【问题描述】:

我想设置一个 cron 作业,以便从 9 月到 5 月每周发送电子邮件。到目前为止我对 cron.yaml 的了解:

- description: mail
  url: /crontask
  schedule: every monday 09:00  ["from" (first Monday of September) "to" (last Monday of May)]

app.yaml:

- url: /.*
  script: myapp.application

蟒蛇:

class CronTask(Handler):
    def post(self):
        *send out mail*

python 映射:

application = webapp2.WSGIApplication([
                    ('/crontask', CronTask)...

什么是正确的“从”“到”语法?

【问题讨论】:

  • 从 9 月到 9 月可能不起作用?

标签: python google-app-engine cron


【解决方案1】:

看起来这个处理程序每​​周调用一次。如果您使用 Python 的 datetime 库而不是在 crontab 上指定它来检查 CronTask 处理程序中的日期怎么办?

或者,来自文档“括号仅用于说明,引号表示文字。”,因此不要使用这些括号和引号。有效的行可能类似于:

schedule: every monday of sep,oct,nov,dec,jan,feb,mar,apr,may 17:00

【讨论】:

    猜你喜欢
    • 2023-03-12
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-05-28
    • 2012-01-11
    • 2016-03-09
    相关资源
    最近更新 更多