astwood
astwood

Reputation: 85

CakePHP Error when Calling custom shell via Cron on the Console

Please can you help. I've recently moved a cakephp app to a new server and cannot get the final bit of the configeration to work.

We have a cron set to run a scheduled task every minute. The cron is being called correctly and running the following script:

#! /bin/sh
cd /home/astadm1n/public_html/app/api/app 
#cake send_sms
/usr/local/bin/cake send_sms

So when I run this on the console manually I get the following error:

[email protected] [~/public_html/app/api/app]# #cake send_sms
[email protected] [~/public_html/app/api/app]# /usr/local/bin/cake send_sms
Error: Could not load class Console
#0 /home/astadm1n/public_html/app/api/lib/Cake/Log/LogEngineCollection.php(41): LogEngineCollection::_getLogger('Console')
#1 /home/astadm1n/public_html/app/api/lib/Cake/Log/CakeLog.php(198): LogEngineCollection->load('stdout', Array)
#2 /usr/local/lib/php/Cake/Console/Shell.php(885): CakeLog::config('stdout', Array)
#3 /usr/local/lib/php/Cake/Console/Shell.php(184): Shell->_useLogger()
#4 /usr/local/lib/php/Cake/Console/ShellDispatcher.php(254): Shell->__construct()
#5 /usr/local/lib/php/Cake/Console/ShellDispatcher.php(200): ShellDispatcher->_getShell('send_sms')
#6 /usr/local/lib/php/Cake/Console/ShellDispatcher.php(68): ShellDispatcher->dispatch()
#7 /usr/local/bin/cake.php(51): ShellDispatcher::run(Array)
#8 {main}
[email protected] [~/public_html/app/api/app]# ^C
[email protected] [~/public_html/app/api/app]#

Can anyone spot why this error is occurring?

Thanks for your help

Mike

Upvotes: 0

Views: 381

Answers (1)

Vicky
Vicky

Reputation: 171

Try this:-

* * * * * cd /abs/path/to/app && Console/cake shell_name function_to_run

Upvotes: 2

Related Questions