laruniq
(laruniq)
December 16, 2018, 8:31pm
1
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.
Hi
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.
Thanks
laruniq
(laruniq)
December 19, 2018, 3:10pm
3
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
or
/public_html/protected/yiic script update
Hope this will answer you in detail
And please refer below link for more info on this
https://www.yiiframework.com/doc/guide/1.1/en/topics.console
Thanks
laruniq
(laruniq)
December 21, 2018, 4:05pm
5
Thank you so much!!! It’s working