0

I am working with the Magento2 Cron functionality, I have created a cron in the crontab.xml (Every 5 mins) default group

<job instance="Namespace\ModuleName\Cron\ServiceOrdersStatusUpdate" method="execute" name="ns_cron_status_update_for_service_orders">
   <config_path>*/5 * * * *</config_path>
        </job>

After that, I noticed in admin system->config->system->Cron (Scheduled Tasks). there have some settings (Cron configuration options for the group: default).

So when the cron will be executed what is the difference between them both.

Also, I've created a command line for my cron file and added that into Magento crontab as follows

* */2 * * * php /var/www/html/bin/magento  service-order:status-update
#~ MAGENTO START 69dd2b02e1f3a65918182048ea4e29979a849d8942e8f53ed20a4bf10e529b36
#* * * * * /usr/bin/php /var/www/html/bin/magento cron:run 2>&1 | grep -v "Ran jobs by schedule" >> /var/www/html/var/log/cron/magento.cron.log
#* * * * * /usr/bin/php /var/www/html/update/cron.php >> /var/www/html/var/log/cron/update.cron.log
#* * * * * /usr/bin/php /var/www/html/bin/magento setup:cron:run >> /var/www/html/var/log/cron/setup.cron.log
#~ MAGENTO END 69dd2b02e1f3a65918182048ea4e29979a849d8942e8f53ed20a4bf10e529b36

If I am adding my cron in the crontab, do I need to keep that cron in crontab.xml?

1 Answer 1

0

In admin system->config->system->Cron (Scheduled Tasks). This setting is for cron Schedules (Cron configuration options for the group: default).

But your custom cron executes every five minutes as per your crontab.xml (Every 5 mins).

You need to keep that cron in crontab.xml

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.