linkyndy
linkyndy

Reputation: 17900

CakePHP Shell cronjob: Error: Class TestingShell could not be loaded

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.

Upvotes: 3

Views: 2937

Answers (2)

Dan
Dan

Reputation: 98

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.

Upvotes: 2

dogmatic69
dogmatic69

Reputation: 7575

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

Upvotes: 1

Related Questions