I created a module and want to use it through cron, and in the end I call the cron: run
command, here are my files, what is wrong here?
namespace AutoAddtocart\BundleAddtocart\Cron;
class Addtocartauto
{
protected $_logger;
public function __construct(
\Psr\Log\LoggerInterface $logger
)
{
$this->_logger = $logger;
}
public function execute()
{
$this->_logger->debug('Cron run successfully');
return $this;
}
}
Cron xml file
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Cron:etc/crontab.xsd">
<group id="default">
<job instance="AutoAddtocart\BundleAddtocart\Cron\Addtocartauto" method="execute" name="add_to_cart_by_cron">
<schedule>* * * * *</schedule>
</job>
</group>
</config>
cron:run
from your terminal in your Magento folder and checkcron_schedule
database table, if youradd_to_cart_by_cron
job_code is coming or not.var/logs
if logs are printing or not the messageCron run successfully