0

We started to have some issues with our quotes not being cleaned correctly.

I checked list of cron jobs and could not find sales_clean_quotes in the list.

We are currently running Magento 2.3.3. How can I force sales_clean_quotes to be run? Is there a setting somewhere that might be turned off?

Shopping cart settings look ok. Is there any other settings I need to configure for the cron task to be run?

Shopping Cart Settings

Kalvin Klien
  • 806
  • 7
  • 28
  • Does it work when you run the file manually? I mean you load the class and run the method manually – Jimmy Mar 19 '21 at 02:14
  • @Jimmy I'm not sure how to manually run it. Is there a CLI command to spool up sales_clean_quotes? – Kalvin Klien Mar 19 '21 at 02:46
  • 1
    Do you know programing? If yes, please check this answer https://magento.stackexchange.com/a/96875/80023. If no then you can check var/log folder to see if any cron or general error there – Jimmy Mar 19 '21 at 03:39
  • @KalvinKlien check my answer - https://magento.stackexchange.com/a/350118/3723 – Bhavesh Godhani Nov 25 '21 at 07:17
  • @KalvinKlien Also, you can check in your cPanel for cron setup is proper or not? php /home//public_html/bin/magento cron:run > /home//public_html/var/log/magento.cron.log – Bhavesh Godhani Nov 25 '21 at 08:35

2 Answers2

2

You can run crons manually if you install the N98 Magerun tool for Magento 2 https://github.com/netz98/n98-magerun2.

The crons can individually be executed by running ./n98-magerun2.phar sys:cron:run <identifier>, which in your case, it will be:

./n98-magerun2.phar sys:cron:run sales_clean_quotes

without the n98 tool, you are not able to run an individual cron command on its own outside Magento's cron management.

Diana
  • 5,137
  • 1
  • 11
  • 26
1

You can run crons manually create one file like custom_cron.php in root directory of magento and set in cron as per your requirement but it's not good way for that but temporary solution.

Also, you have run one time then hit URL in browser for that as below.

https://example.com/custom_cron.php

<?php
error_reporting(E_ERROR | E_WARNING);
ini_set('display_errors', 1);
ini_set('max_execution_time','18000');
ini_set('memory_limit', '-1');

set_time_limit(0); ini_set('memory_limit','2048M'); require 'app/bootstrap.php'; echo "start cron:----"; use Magento\Framework\App\Action\Context; use Magento\Framework\App\Filesystem\DirectoryList; use Magento\Framework\App\Response\Http\FileFactory; use Magento\Framework\Filesystem;

class Customerreport extends \Magento\Framework\App\Http implements \Magento\Framework\AppInterface { public function launch() {

    $this-&gt;_state-&gt;setAreaCode(\Magento\Framework\App\Area::AREA_ADMINHTML);


   $myClass = $this-&gt;_objectManager-&gt;create('Magento\Sales\Cron\CleanExpiredQuotes');
   $myClass-&gt;execute(); 

    return $this-&gt;_response;
}

}

$bootstrap = \Magento\Framework\App\Bootstrap::create(BP, $_SERVER); /** @var \Magento\Framework\App\Http $app */ $app = $bootstrap->createApplication('Customerreport'); $bootstrap->run($app); echo "end cron:----";

Bhavesh Godhani
  • 579
  • 1
  • 5
  • 17