I setup a cron job task on my cpanel account running every five minutes pointing to curl "http://domain/admin/index.php?controller=AdminCronJobs&token=b883b19bfc82743cb3b94165d31806d4" and i receive the email alert after the cron run so, this one is running. My Prestashop Cron tasks manager (module cronjobs) is pointing to http://domain/admin/index.php?controller=AdminModules&token=988bbbea561a66f8cbd4bc8ae256587a&configure=productimporter&tab_module=others&module_name=productimporter&runners=0 and running every hour.
I configured some error_logs in my module code that's supposed to run and nothing is printed to the error_logs file.
If i run the http://domain/admin/index.php?controller=AdminModules&token=988bbbea561a66f8cbd4bc8ae256587a&configure=productimporter&tab_module=others&module_name=productimporter&runners=0 in the browser, logged on the admin, instead of running in the cron task the code execute perfectly and also print the error_logs to the error_logs file. So, if i'm not wrong, the problem is that when the cron starts running the URL, the Prestashop ask for authentication and so my code is not executed.
What should i do to escape authentication?
Thanks!
Update: It´s been a while since I resolved this post so I'm a bit forgotten of how i end up with this solution.
I set a cron job in my cpanel account:
/usr/bin/php public_html/modules/module/update-me-up.php k=somethingYouWant > /dev/null 2>&1
This cron will call my update-me-up file, and this file will call the class i want.
<?php
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
ini_set("log_errors", 1);
ini_set("error_log", $logPath);
error_log('new');
error_log(dirname(__FILE__));
include(dirname(__FILE__).'/../../config/config.inc.php');
//include(dirname(__FILE__).'/../../init.php');
$key = 'somethingYouWant ';
if(!Tools::getValue('k') || Tools::getValue('k') != $key){
error_log('unauthorized');
die('unauthorized');
}
error_log(dirname(__FILE__).'/classIWant.php');
include(dirname(__FILE__).'/classIWant.php');
error_log('Cron task starting');
$a = new classIWant();
$a->run();