How would test cron with Magento?

后端 未结 5 616
有刺的猬
有刺的猬 2021-01-30 18:29

First I need to understand how Magento cron works.

I know how cron works on linux, using crontab -e.
I know I need to set up Magento\'s cron.php to run

5条回答
  •  不要未来只要你来
    2021-01-30 19:00

    adding these to the bottom of cron.php will make it write out cron.php.log on execution with the datetime

    try {
        Mage::getConfig()->init()->loadEventObservers('crontab');
        Mage::app()->addEventArea('crontab');
        Mage::dispatchEvent('default');
    
    $log = fopen(__FILE__.'.log', 'a');
    fwrite($log, date("Y-m-d H:i:s").PHP_EOL);
    fclose($log);
    } catch (Exception $e) {
        Mage::printException($e);
    }
    

提交回复
热议问题