Yii Framework Forum: run a cron job with Yii using cmd - Yii Framework Forum

Jump to content

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

run a cron job with Yii using cmd cron jobs using application console commands Rate Topic: ****- 7 Votes

#1 User is offline   deepeshsaini 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 12
  • Joined: 30-May 12
  • Location:india

Posted 30 May 2012 - 02:32 AM

*
POPULAR

1. database connection, in /protected/config/console.php
2. for connection establish /protected/config/main.php File open select All or paste in console.php file
3. then /protected/commands/SiteCommand.php
4. below code paste in SiteCommand.php File

<?php
        class SiteCommand extends CConsoleCommand
        {
          public function run($args)
          {
       	echo 'hello yii friends';
          }
   	}
?>


5. then open cmd
6. \path\protected>yiic then press Enter Key
7. then cmd show your commend name
8. \path\protected>yiic site then press Enter Key
9. show your output "hello yii friends".

Attached File(s)


6

#2 User is offline   Maurizio Domba Cerin 

  • Yii - Yesss It Is !!!
  • Yii
  • Group: Yii Dev Team
  • Posts: 4,359
  • Joined: 12-October 09
  • Location:Croatia

Posted 30 May 2012 - 02:55 AM

NOTE: moved to proper section (Tips, Snippets and Tutorials instead of General Discussion for Yii 1.1.x)

Welcome to the Yii forum, you made a nice first post :)
Find more about me.... btw. Do you know your WAN IP?
1

#3 User is offline   fouss 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 394
  • Joined: 05-October 10
  • Location:Bamako Mali

Posted 10 June 2012 - 05:36 AM

Great; +1 for that!
Posted Image
0

#4 User is offline   jpm 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 26
  • Joined: 17-April 11
  • Location:Austin TX

Posted 24 June 2012 - 11:21 PM

Nice, clear and concise. +1
0

#5 User is offline   zahoor85 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 1
  • Joined: 14-December 12

Posted 23 January 2013 - 01:48 AM

Nice one thanks. It helped me :)
0

#6 User is offline   Mohd. Tabrez 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 5
  • Joined: 07-March 11

Posted 28 February 2013 - 09:32 AM

Good one Buddy :)
0

#7 User is offline   Abhishek Shah 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 90
  • Joined: 20-July 12
  • Location:New Jersey,USA

Posted 26 March 2013 - 03:06 AM

It will workonly when you run from command prompt,cron job,means ,you have to add schedule a job,will execute on particular interval,For that I am using a extension from yiimann,yii-crontab
.By it,I have successfully scheduled cron jobs.
Feel free to ask for help,
Abhishek.
Freelancer.
Yii Basic Gii With Export Pdf Excel
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