【问题标题】:Aws Elastic Beanstalk not executing cron.yaml fileAws Elastic Beanstalk 不执行 cron.yaml 文件
【发布时间】:2020-10-02 20:47:24
【问题描述】:

我目前在项目的根目录中有一个文件 cron.yaml。

version: 3
cron:
 - name: "shopify"
   url: "/shopify"
   schedule: "0 * * * *"
 - name: "quickbooks"
   url: "/qb'"
   schedule: "0 * * * *"
 - name: "Shopify-Completed"
   url: "/shopify-completed"
   schedule: "0 * * * *"
 - name: "License-Orders"
   url: "/getLicenseOrders"
   schedule: "0 * * * *"
 - name: "Tee-Orders"
   url: "/getTeesOrders"
   schedule: "0 * * * *"
 - name: "Engraved-Orders"
   url: "/getEngravedOrders"
   schedule: "0 * * * *"
 - name: "Engraved-Mexico-Orders"
   url: "/getMexicoEngravedOrders"
   schedule: "0 * * * *"
 - name: "Shopify-All-Orders"
   url: "/pull-shopify-orders"
   schedule: "*/10 * * * *"

这些都是我项目中经过验证的路线。 例如,当我手动转到 example.com//pull-shopify-orders 时,它会执行。 但是,当它在 cron 中时,它不会触发。 知道为什么吗?

【问题讨论】:

  • 你运行的是worker环境还是web one?
  • 网络一@Marcin
  • 另外,请确保您的路线响应 POST。

标签: amazon-web-services cron amazon-elastic-beanstalk


【解决方案1】:

cron.yaml 仅支持worker environments

您可以在源包中名为 cron.yaml 的文件中定义定期任务,以定期自动将作业添加到您的工作环境的队列中。

对于网络环境,您必须使用.ebextentions“手动”设置 cron。这在最近的 AWS 博客文章中得到了证明:

这涉及创建带有定义的filescommands 部分的cron-linux.config(示例名称)文件。

【讨论】:

    猜你喜欢
    • 2015-05-08
    • 2016-05-22
    • 2013-04-11
    • 2017-07-31
    • 2021-12-30
    • 2019-03-22
    • 2015-09-26
    • 2015-02-18
    相关资源
    最近更新 更多