Yii Framework Forum: How Can I Call Crontab For Command/action - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

How Can I Call Crontab For Command/action Rate Topic: -----

#1 User is offline   hoonglc 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 98
  • Joined: 06-September 11
  • Location:Malaysia

Posted 11 January 2013 - 03:00 AM

Hi all,

I would like to know how can i run the command action but not default action function run? i have an command name auth and i would like to run for actionRemoveSsoToken. When i run from putty, i use this command : php console.php Auth RemoveSsoToken

i was using Yii extension crontab to run it, but the result was it will call function run and RemoveSsoToken will become an array for args[0].

<?php
class AuthCommand extends CConsoleCommand
{
    public function getHelp()
    {
        echo "Deleted unconfirmed registration entries";
    }

    public function run($args)
    {
    echo 'run';
    }
	
	public function actionRemoveSsoToken(){
		$modelSsoToken = new SsoToken();
		$count = $modelSsoToken->clearSsoToken();
		$classEmail->sendMail('test@gmail.com', 'Test Cron', $count, 'Tester', 'test2@gmail.com', '');
	}
}
?>


Anyone got an idea how to call the action?
0

#2 User is online   alirz23 

  • Master Member
  • PipPipPipPip
  • Yii
  • Group: Members
  • Posts: 752
  • Joined: 08-August 12
  • Location:Durban, South Africa

Posted 11 January 2013 - 06:47 AM

bro just call that function inside run that should solve your problem
0

#3 User is offline   hoonglc 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 98
  • Joined: 06-September 11
  • Location:Malaysia

Posted 15 January 2013 - 01:18 AM

View Postalirz23, on 11 January 2013 - 06:47 AM, said:

bro just call that function inside run that should solve your problem


Hi alirz23,

thank for you info, i have try to create command action and test. In the end only i found out i have to remove the run function, else it will ignore the action that call from putty
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users