We have added the following lines to the crontab file to run magento cron after every 1 minute.

* * * * * /bin/php -c /etc/php.ini /home/centos/public_html/staging/bin/magento cron:run > /home/centos/public_html/staging/var/log/magento.cron.log&

* * * * * /bin/php -c /etc/php.ini /home/centos/public_html/staging/update/cron.php > /home/centos/public_html/staging/var/log/update.cron.log&

* * * * * /bin/php -c /etc/php.ini /home/centos/public_html/staging/bin/magento setup:cron:run > /home/centos/public_html/staging/var/log/setup.cron.log&

We have created cron job for our module under magento default group which is to be executed after every 30 minutes.

<job name="auto_review_email" instance="MyCompany\ModuleName\Cron\AutoReviewEmail" method="execute">
    <schedule>*/30 * * * *</schedule>

But when we check in cron_schedule table and in our logs, cron job finished after 1 minute without executing completely. Please refer to below screenshot:-

enter image description here

We have tried using flock in crontab, checked the server timings but nothing worked.

Please advise. Thanks.

  • 1
    Refer to the link: magento.stackexchange.com/questions/261722/… and create a controller where you can debug your cron. From the look of this, cron scheduling not have any issue, your cron is completing in a second, so you need to debug your script to resolve this issue – Shoaib Munir Mar 27 '19 at 18:47
  • @ShoaibMunir Munir Yes, It was issue with script. Thanks – Priyanka Apr 1 '19 at 10:03
  • Do I convert it in answer? so that it will helpful for others in future – Shoaib Munir Apr 1 '19 at 10:08

Your Answer

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

Browse other questions tagged or ask your own question.