0

I've created a module with a cron, the module is registered with no problem and the crontab.xml looks like this:

<?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 name="tracking_status_cron" instance="Custom\TrackingCron\Cron\TrackingStatusCron" method="execute">
            <schedule>50 11 * * *</schedule>
        </job>
    </group>
</config> 

Then the Cron/TrackingStatusCron.php

<?php

namespace Custom\TrackingCron\Cron;

include('PHPMailer/PHPMailerAutoload.php');
use Magento\Framework\App\Bootstrap;
use Magento\Sales\Model\Order;

class TrackingStatusCron
{
    public function execute() {
        $writer = new \Zend\Log\Writer\Stream(BP . '/var/log/Trackngcron.log');
        $logger = new \Zend\Log\Logger();
        $logger->addWriter($writer);
        $logger->info('Correu Cron');
    }
}

And it created that Trackngcron.log when I had in xml the schedule 30 18 * * * at 19h 30h, I think that's the difference between server and my timezone. But now it does not run no matter the time schedule I define, i want it to run every 15min so I tried with * * * * * because it's in default group and tried */15 * * * * but none of them work.

Am I doing anything wrong? Idk what I changed so it does not run anymore.

Thanks :D

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.