简体   繁体   English

Google App Engine Cron Job

[英]Google App Engine Cron Job

I have created a cron.xml file and a servlet which describes the job. 我创建了一个cron.xml文件和一个描述该作业的servlet。
Now when i compile and login as an admin, local development dashboard doesn't show Cron Jobs link. 现在,当我作为管理员编译和登录时,本地开发仪表板不显示Cron Jobs链接。

Local development server does not have the Cron Jobs link neither does it execute cron jobs. 本地开发服务器没有Cron Jobs链接,也没有执行cron作业。 The actual appengine will show cron jobs and will execute them. 实际的appengine将显示cron作业并将执行它们。

You can manually execute cron jobs on local server by visiting their urls. 您可以通过访问其URL来手动执行本地服务器上的cron作业。 eg http://localhost:8888/FindReservedBooksTask . 例如http:// localhost:8888 / FindReservedBooksTask

BTW the cron.xml file should be in the war/WEB-INF directory. BTW cron.xml文件应该在war / WEB-INF目录中。

The dev appserver doesn't automatically run your cron jobs. dev appserver不会自动运行您的cron作业。 You can use your local desktop's cron or scheduled tasks interface to hit the URLs of your jobs with curl or a similar tool. 您可以使用本地桌面的cron或计划任务界面,使用curl或类似工具点击作业的URL。

Here is the link to the GAE doc on this. 以下是关于此的GAE 文档的链接。

Also, make sure you disable all security constraints for your crons in the web.xml. 此外,请确保在web.xml中禁用所有安全限制。 If you don't have them -- you should restrict cron to admin accounts . 如果您没有 - 您应该将cron限制为管理员帐户

This website walks you through the way to use cron jobs inside of Google App Engine. website引导您在Google App Engine中使用cron作业。

Also, The Google App Engine provides a service called the Cron Service that helps us do two fundamental things: 此外,Google App Engine提供了一项名为Cron Service的服务 ,可帮助我们完成两项基本任务:

  1. Allows your application to schedule these tasks. 允许您的应用程序安排这些任务。
  2. Execute these tasks based on their schedule. 根据计划执行这些任务。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM