Changes
Title
unchanged
Cron Jobs in Yii
Category
unchanged
How-tos
Yii version
unchanged
Tags
unchanged
cron, cronjobs, heroku, bash, console, Yii Console, yiic
Content
unchanged
[...]
When you are creating a new CronJob, pass any parameters in as an array and the Model will serialize them for you.
Next, we need the CronCommand so that we can process these jobs from the command line. I set mine up with one action (actionIndex) that processes all the jobs. It selects all the jobs that need to be executed that haven't yet been, and starts to process them.
For all the code, check out the github page at [https://github.com/aarondfrancis/yii-CronCommand](https://github.com/aarondfrancis/yii-CronCommand "https://github.com/aarondfrancis/yii-CronCommand"). There you will find the migration, the model, the console command, and a bash script for if you are on Heroku.