Hello!
I tried to create a console command for cron, but I have a problem. I created the console command by guide http://www.yiiframework.com/doc/guide/1.1/en/topics.console and when cron executes, I have a message on my e-mail:
X-Powered-By: PHP/5.3.8
Content-type: text/html
No available commands.
Please define them under the following directory:
/home/username/public_html/protected/commands
. I have the following cron command:
php /home/username/public_html/cron.php DeleteTmpFiles
. /cron.php
<?php
$yii = dirname(__FILE__) . '/../yii-1.1.9.r3527/framework/yii.php';
$config = dirname(__FILE__) . '/protected/config/cron.php';
//defined('YII_DEBUG') or define('YII_DEBUG', true);
require_once($yii);
Yii::createConsoleApplication($config)->run();
, /protected/config/cron.php
<?php
return array(
'basePath' => dirname(__FILE__) . DIRECTORY_SEPARATOR . '..',
'charset' => 'utf-8',
'components' => array(
'log' => array(
'class' => 'CLogRouter',
'routes' => array(
array(
'class' => 'CFileLogRoute',
'logFile' => 'cron.log',
'levels' => 'error, warning',
),
array(
'class' => 'CFileLogRoute',
'logFile' => 'cron_trace.log',
'levels' => 'trace',
),
),
),
),
'import' => array(
'application.components.*',
'application.models.*',
),
'name' => 'Cron',
'params' => require(dirname(__FILE__) . '/params.php'),
'preload' => array('log'),
);
, protected/commands/DeleteTmpFiles.php
<?php
class DeleteTmpFilesCommand extends CConsoleCommand
{
public function run($args)
{
//
}
}
. What am I doing wrong?