Showing results for 
Search instead for 
Did you mean: 

custom module cronjob


custom module cronjob



on magento 2.2.1, I followed this:

and it works. Then I wanted to apply it to my custom (working) module:


namespace Hoop\Util\Cron;
use \Psr\Log\LoggerInterface;

class Test {
    protected $logger;

    public function __construct(LoggerInterface $logger) {
        $this->logger = $logger;

     * Write to system.log
     * @return void

    public function execute() {



<?xml version="1.0"?>
<config xmlns:xsi="" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Cron:etc/crontab.xsd">
    <group id="default">
        <job name="hoop_cronjob" instance="Hoop\Util\Cron\Test" method="execute">
            <schedule>* * * * *</schedule>

but it's not working, what am I doing wrong?

Thanks a lot


Re: custom module cronjob

Your path define Block and in your xml file you doesn't define Block file in path,

/app/code/hoop/Util/Block/Cron/Test.php and your Test.php file inside only Cron Folder.


Verify first your path and file would be both same as decalre in xml file.

If Issue Solved, Click Kudos/Accept As solutions.