Cron工作没有在谷歌应用引擎+ Laravel 4中执行

时间:2015-11-17 06:50:06

标签: php google-app-engine laravel laravel-4 crontab

我正在将我在Laravel 4中开发的应用程序转移到Google App Engine。我已经按照本教程中提到的步骤进行了操作

https://gae-php-tips.appspot.com/2013/10/22/getting-started-with-laravel-on-php-for-app-engine/

一切都很完美。要在Google App引擎中设置cron jb,我创建了一个cron.yaml文件。但问题是它没有被执行。我搜索了解决方案,但没有发现任何问题。以下是我的cron.yaml文件

cron:
 - description: Todo reminder
   url: /gae_cron/todo_reminder
   schedule: every 1 minutes from 00:00 to 23:59

我的app.yaml文件

application: test
version: beta-1-11
runtime: php55
api_version: 1

handlers:

    - url: /favicon\.ico
      static_files: public/favicon.ico
      upload: public/favicon\.ico

    - url: /packages
      static_dir: public/packages

    - url: /assets
      static_dir: public/assets

    - url: /views
      static_dir: public/views

    - url: /.*
      script: public/index.php

这是我从cron.yaml调用的路线

 Route::get('gae_cron/todo_reminder', function() {
   Log::info('todo reminder route');
 });

但我在日志中看不到任何内容。但是,当我通过直接粘贴浏览器中的URL来执行它时,它会显示在日志中。

有没有人设法通过Laravel在GAE中完成cron工作。

1 个答案:

答案 0 :(得分:1)

根据Google App Engine文档

You can use appcfg.py to upload cron jobs and view information about the defined cron jobs. When you upload your application to App Engine using appcfg.py update, the Cron Service is updated with the contents of cron.yaml. You can update just the cron configuration without uploading the rest of the application using appcfg.py update_cron

单独上传cron条目

appcfg.py -A <project-id> update_cron .

验证转到

Compute->App Engine->Task queues

在那里,您将找到cron.yaml文件中提到的所有cron条目

相关问题