CakePHP Shell cronjob:错误:无法加载类TestingShell
我正在尝试在 CakePHP 工作中获得一个 cronjob 。但我收到此错误:错误:无法加载类TestingShell。
这是我的/app/vendors/shells/testing.php
文件:
class TestingShell extends Shell {
var $uses = array('Test');
function main(){
$this->out('Number of tests :');
$this->out($this->Test->find('count'));
$this->out('.');
if($this->Test->delete(1)){
$this->out('test deleted');
}
else{
$this->out('test not deleted');
}
}
}
我正在调用像这样的 cronjob: /home/root/public_html/site/cake/console/cake -app /home/root/public_html/site/apptesting
我做错了什么?非常感谢!
编辑 我必须补充一点,外壳在本地工作正常。
I am trying to get a cronjob in CakePHP work. But I am getting this error: Error: Class TestingShell could not be loaded.
Here is my /app/vendors/shells/testing.php
file:
class TestingShell extends Shell {
var $uses = array('Test');
function main(){
$this->out('Number of tests :');
$this->out($this->Test->find('count'));
$this->out('.');
if($this->Test->delete(1)){
$this->out('test deleted');
}
else{
$this->out('test not deleted');
}
}
}
I am calling the cronjob like this: /home/root/public_html/site/cake/console/cake -app /home/root/public_html/site/app testing
What am I doing wrong? Thank you very much!
EDIT I must add that, locally, the shell works fine.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
查看此错误报告——这是我的问题。
http://cakephp.lighthouseapp.com /projects/42648/tickets/1601-cakephp-138-console-ignores-app-parameter
回滚到1.3.7 是快速修复。
Check out this bug report -- this was my problem.
http://cakephp.lighthouseapp.com/projects/42648/tickets/1601-cakephp-138-console-ignores-app-parameter
Rolling back to 1.3.7 was the quick fix.
看看这个,您可能还需要添加 shell 脚本
http:// /book.cakephp.org/view/1110/Running-Shells-as-cronjobs
你的参数也有错误,它的
1 * * * * cake/path scritp params -app app/path
have a look at this, you may also need the added shell script
http://book.cakephp.org/view/1110/Running-Shells-as-cronjobs
you also have the params wrong way round, its
1 * * * * cake/path scritp params -app app/path