I am trying to set up a cron job using COdeigniter but I cannot figure out how to get it to work. I have a file called email_check.php in my controllers folder, and I have added a .cron file to the servers cron folder, which contains the following
email_check.cron
*/1 * * * * php /var/www/html/application/controllers/email_check
email_check.php
class Email_check extends CI_Controller {
function __construct()
{
parent::__construct();
$this->index();
}
function index()
{
$this->load->model('admin/info_model');
$this->info_model->addTestData();
}
}
The addTestData adds a new row into a database table. I would like this to run every minute, however it isn't working at all and I have no idea why.
Maybe it may be the paths that are wrong. Do I need to point the php part to the php.exe in the server.
If anyone could help or point me in the right direction it would be greatly appreciated!