Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SilverStripe running BuildTasks error via CronJob

I'm working on running tasks via CronJob in SilverStripe 3.1.

I tested with command line, everything works fine.

But via Cron job, it always gives the following message:

Please specify an argument to cli-script.php/sake. For more information, visit http://doc.silverstripe.org/framework/en/topics/commandline**"

I have read the docs but I still have no idea.

My cron job command:

/my_site_path/framework/sake dev/tasks/SendNewsLetter >> /my_site_path/newsletter.log 2>&1

I created a SendNewsLetter task which is extended from BuildTask.

I tried it in the browser and command line, it all seems to work with no problem. However, I haven't been able to get it working with cron job.

like image 906
Fang Fang Avatar asked Jan 18 '26 10:01

Fang Fang


1 Answers

Try executing it this way instead:

php-cli -q /my_site_path/framework/cli-script.php dev/tasks/SendNewsLetter >> /my_site_path/newsletter.log 2>&1

like image 159
Adam Stead Lane Avatar answered Jan 20 '26 00:01

Adam Stead Lane



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!