Error: Unknown action (Cron)

Hi, i try to configure a cron task(* * * * * ./public_html/protected/yiic script ScriptCommand)for a file but it failed because it seems like the name of the action is wrong.
The file is ScriptCommand.php, but what should be the action be? I don’t understand.
I want the whole file to execute not only a specific action.


Do you have “run” method in your command file?

Yii command try to execute from run method only. From run method you can call your own methods and logic.


No but i have these commands @rameshnaik5521 :

The following commands are available:

  • abstract
  • clearcache
  • daily
  • message
  • migrate
  • script
  • shell
  • webapp

Hi @laruniq

I am guessing, the way you are running the script is wrong
because your error itself says there is no method (action) with the name of ScriptCommand.

Open your ScriptCommand file and find out what are actions (normally methods) are available in it.
Pass those action names while running the script

Giving an example and hoping that will help you out

Let your ScriptCommand similar below

class ScriptCommand extends CConsoleCommand
public function actionIndex() { … }
public function actionUpdate() { … }


then you can run the script as

/public_html/protected/yiic script index
/public_html/protected/yiic script update

Hope this will answer you in detail

And please refer below link for more info on this


Thank you so much!!! It’s working :smiley: