CakePHP控制台通过Cron问题 [英] CakePHP Console via Cron Question

查看:286
本文介绍了CakePHP控制台通过Cron问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用CakePHP控制台从我们下载文件并在数据库中处理。我从app目录中运行控制台。但是当我试图运行控制台外部应用程序,通过只设置-app参数为我的cron作业,它不工作。

I'm using the CakePHP Console to download files from we and processed in a database. I'm running the console from inside the "app" directory. But when I'm trying to run the console outside app and by just setting the "-app" parameter for my cron job, it doesn't work.

说实话,我使用-app参数没有成功。这就像它不工作。

To be honest, I've had no success using -app parameter. It's like it's not working at all.

顺便说一下,我使用Windows& Pycron我的cron工作。

By the way, I'm using Windows & Pycron for my cron jobs.

下面是当我尝试从D运行控制台时会发生什么:\

Here's what happens when I'm trying to run the console from D:\

D:\>web\elink\cake\console\cake -app D:\web\elink\app


Welcome to CakePHP v1.2.2.8120 Console
---------------------------------------------------------------
Current Paths:
 -app: app
 -working: D: -app D:/web/elink/app
 -root: D: -app D:/web/elink
 -core: D:\web\elink

Changing Paths:
your working path should be the same as your application path
to change your path use the '-app' param.
Example: -app relative/path/to/myapp or -app /absolute/path/to/myapp

Available Shells:

 D:\web\elink\vendors\shells:
         - none

 CORE\console\libs:
         acl
         api
         bake
         console
         i18n
         schema
         testsuite

To run a command, type 'cake shell_name [args]'
To get help on a specific command, type 'cake shell_name help'

我的shell位于D:\web\elink\ app\vendors\shells。

My shells are located at D:\web\elink\app\vendors\shells.

推荐答案

- 对于有相同问题但在linux系统上的人,简单解决方案:

-For the people having the same problem but on linux systems, here there is an easy solution:

http://book.cakephp.org/complete/3/The-Manual#Running-Shells-as-cronjobs-846

任何系统的另一个替代解决方案是创建一个简单的脚本,有两行如下:

-Another alternative solution for any system would be to create a simple script with two lines like this:

cd /path/to/app
/path/to/cake

在Cent0S和基于MacOS的机器中。

-Both solutions worked for me in a Cent0S and in a MacOS based machines.

这篇关于CakePHP控制台通过Cron问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆