I am trying to implementing cron job for my module but getting error in CLI
.
I am using windows operating system.
here is crontab.xml
<?xml version="1.0" encoding="UTF-8"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Cron:etc/crontab.xsd">
<group id="customdesignsubcategories_cron">
<job name="uploadFile_deletion" instance="vendermoduleCronUploadFileDeletion" method="execute">
<schedule>1/2 * * * *</schedule>
</job>
</group>
here is UploadFileDeletion.php
<?php
namespace vendermoduleCron
class UploadFileDeletion
{
protected $_logger;
public function __construct(PsrLogLoggerInterface $logger)
{
$this->_logger = $logger;
}
public function execute()
{
$this->_logger->debug('Cron run successfully');
return $this;
}
}
following commands i fire in CLI
php bin/magento cron:run --group="customdesignsubcategories_cron"
Error =>
[MagentoFrameworkExceptionLocalizedException] Invalid Document
Element ‘job’: The attribute ‘instance’ is required but missing.
Line: 4Element ‘job’: The attribute ‘method’ is required but missing.
Line: 4Element ‘schedule’: Element content is not allowed, because the type
definition is simple. Line: 5Element ‘schedule’: [facet ‘minLength’] The value has a length of
‘0’; this underruns the allowed minimum length of ‘5’. Line: 5Element ‘schedule’: ” is not a valid value of the list type
‘scheduleDeclaration’. Line: 5Element ‘run’: This element is not expected. Expected is (
config_path ). Line: 8cron:run [–group GROUP] [–bootstrap BOOTSTRAP]