Cron and CConsoleApplication

Hi all,

I try to make a cron job.

This cron is called by Server in a shell file the contain is:


#!/bin/bash

exec /usr/local/bin/php.ORIG.5_3  /homez.xxx/annuaireb/www/protected/yiic.php cron

Then

in my webApp:

I have this in config/console.php


    'commandMap'=>array(

        'myCron'=>array(

            'class'=>'ext.surprise.EAccountVerifier',


        ),

        // other commands

    ),

And in my extensions/surprise/EAccountVerifier.php this:




class EAccountVerifier extends CConsoleCommand {

	

    private $_mDateArray;

    

    private $_stopCron = true; // By default one cron task is enough

    

    public function run($args)

	{

       Yii::trace('************* On passe ' );

    }



When cron is called i get a cron_trace.log (in Yii, I configured this in console.php). The contain is :


2012/06/08 11:35:04 [trace] [system.CModule] Loading "log" application component

And Finally I get in the Log:


-------------------------==  Début  ==-------------------------


br /

bDeprecated/b:  Directive 'register_globals' is deprecated in PHP 5.3 and greater in bUnknown/b on line b0/bbr /

br /

bDeprecated/b:  Directive 'magic_quotes_gpc' is deprecated in PHP 5.3 and greater in bUnknown/b on line b0/bbr /

X-Powered-By: PHP/5.3.10

Content-type: text/html


Yii command runner (based on Yii v1.1.<img src='http://www.yiiframework.com/forum/public/style_emoticons/default/cool.gif' class='bbc_emoticon' alt='8)' />

Usage: /homez.xxx/annuaireb/www/protected/yiic.php command-name [parameters...]


The following commands are available:

 - message

 - migrate

 - myCron

 - shell

 - webapp


To see individual command help, use the following:

  /homez.xxx/annuaireb/www/protected/yiic.php help command-name


-------------------------==   Fin   ==-------------------------

I try this during 2 days without finding why I can’t access to my myCron code.

Yii seems to render me kind of help message…

is there something wrong with my approach ?

Thanks

You’re calling your command “myCron” but you’re calling “cron” in your crontab.

Yes thanks

And It WORKS…2 days… :o for that.

Is this console a means to call a Yii function from cron?

I am not certain I understand this, but I have a need to call a Yii controller / action on a nightly basis.

I also have a need to create jobs from within the database that can then call the Yii actions.

Externally I allow other outside sources to insert into a database table (mysql) and then I want to be able to communicate with the application via Yii framework.

Thanks for any clarification!