script entry for cron job

i want to implement cron jobs in my application.

i refered to cron jobs




defined('YII_DEBUG') or define('YII_DEBUG',true);

 

// including Yii

require_once('path/to/yii/framework/yii.php');

 

// we'll use a separate config file

$configFile='path/to/config/cron.php';

 

// creating and running console application

Yii::createConsoleApplication($configFile)->run();



where do i put this piece of code?

same with the index.php , you could name it to console.php then you can access it from command line like :

php.exe(or php) c:/xxx/xx/myProject/console.php yourCommand

actually you can use the yiic command too :

C:\Users\myName>php C:\xampp\htdocs\myProject\protected\yiic test

the yiic is come with yii framework and generated by it ,you can find it in protected dir . the original one is under the framework dir you can check it (framework/yiic ,yiic.bat ,yiic.php )