简体   繁体   English

自定义cron作业未计划Magento2

[英]Custom cron job is not scheduling Magento2

I am trying to add cronjob through crontab.xml in my custom module, but they are not appearing in cron_schedule table after running php bin/magento cron:run many times. 我正在尝试通过自定义模块中的crontab.xml添加cronjob,但是在运行php bin/magento cron:run很多次之后,它们没有出现在cron_schedule表中。 If i enter time as <schedule>* * * * *</schedule> it works and job get schedule in cron_schedule table. 如果我以<schedule>* * * * *</schedule>输入时间,它将在cron_schedule表中正常工作并获取时间表。 But i have to set time to run cronjob at 1:00 am. 但是我必须设置时间在凌晨1:00运行cronjob。 here is my crontab.xml 这是我的crontab.xml

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Cron:etc/crontab.xsd">
    <group id="default">
        <job name="abc_import" instance="Abc\Xyz\Model\Api" method="importProducts">
            <schedule>0 1 * * *</schedule>
        </job>
    </group>
</config>

Have you tried flushing cache. 您是否尝试过刷新缓存。

php bin/magento cache:flush

What about running cron like this? 像这样运行cron呢?

php bin/magento cron:run

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM