CakePHP Shell cronjob:错误:无法加载类TestingShell

发布于 2024-11-03 13:19:42 字数 722 浏览 1 评论 0原文

我正在尝试在 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

浪漫之都 2024-11-10 13:19:42

查看此错误报告——这是我的问题。

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.

友欢 2024-11-10 13:19:42

看看这个,您可能还需要添加 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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文