Hi,
Thanks for reply.
I have created everything on my cPanel for run a cron job.
My cakePHP version is 4.x
I have a controller and I added a function there. I want to call this function using cron job.
I have created a file inside webroot named cron_despatcher.php
Here is the code:
My controller code is here:
<?php namespace App\Controller; use App\Controller\AppController; class CornsController extends AppController{ public function initialize(): void { parent::initialize(); $this->loadModel("Corns"); $this->layout = false; } function addCorn() { $data = array(); $check_num = rand(); $data['check_num'] = $check_num; $corns = $this->Corns->newEmptyEntity(); $corn = $this->Corns->patchEntity($corns, $data); $this->Corns->save($corn); } } ?>Cron Command:
/usr/local/bin/php /home/atgo/public_html/webroot/cron_dispatcher.php /Corns/addCorn
But not working.
Can you please check that if I did wrong anything!!!