I have created a custom module which has cronjob to run after certain interval:
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Cron:etc/crontab.xsd">
<group id="default">
<!--cron job to import customer,customer assignment,product data,pricing data and listing master-->
<job name="import_customer_product" instance="Singh\Import\Cron\CustomerProduct" method="execute">
<schedule>* * * * *</schedule>
</job>
<!--cron job to import order,invoice and shipment-->
<job name="import_order_edi" instance="Singh\Import\Cron\OrderImport" method="execute">
<schedule>* * * * *</schedule>
</job>
</group>
</config>
There are 5 processes running for 1st cron and 3 for 2nd cron. If any exception or error comes in process 1, the cron stops and its status change to error, it bypass other 4 processes and execute the next cron.
Content of CustomerProduct.php
:
public function execute() {
$cron = $this->_cronfactory->create();
$this->_logger->info("customer and product import cron started");
$this->_customer->execute();
$this->_logger->info("customer imported");
$this->_customerAssignment->execute();
$this->_logger->info("customer ass imported");
$this->_product->execute();
$this->_logger->info("product imported");
$this->_listingMaster->execute();
$this->_logger->info("listing imported");
$this->_productPricing->execute();
$this->_logger->info("pricing imported");
$this->_logger->info("customer and product import cron finished");
}
What I want is: the cron should run the next process if it found any exception or error in 1st process, it should not bypass other process.