9
*/1 * * * * www-data php /var/www/magento-2/bin/magento cron:run
*/1 * * * * www-data php /var/www/magento-2/update/cron.php
*/1 * * * * www-data php /var/www/magento-2/bin/magento setup:cron:run

this is cron job setting and my 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="send_call" instance="Custom\Module\Model\Observer\Event" method="sendEmail">
      <schedule>*/5 * * * *</schedule>
    </job>
  </group>
</config>

I check many times but cron not working

7
  • and error message?
    – MagenX
    Commented Jan 27, 2016 at 10:40
  • Nothing error but i write a log inside sendEmail function but when i find log is empty Commented Jan 27, 2016 at 11:19
  • The method you have specified is senMail. Is that correct? Should it sendMail?
    – Smartie
    Commented Jan 27, 2016 at 12:19
  • i wrote wrong here but in code that is write so please give accurate answer Commented Jan 27, 2016 at 12:28
  • 1. Did you try to run php /var/www/magento-2/bin/magento setup:cron:run manually? 2. Where is your crontab.xml located?
    – BuskaMuza
    Commented Jan 28, 2016 at 15:02

5 Answers 5

11

Flush Cache and Run Cron again.

php bin/magento cache:flush
php bin/magento cron:run
1
  • This worked for me, for the scenario I had. But I am not sure if this is recommended approach. Commented Jan 27, 2017 at 11:54
6

If flushing the cache with php bin/magento cache:flush doesn’t work for you, check the cron_schedule table and look for your Job Code there. Chances are one of the instances is stuck with status "running" due to some error in your observer. If so, just delete that line from the cron_schedule table and try running the cron again.

6
  • Thanks! This was the issue in my case. There were few cronjobs whose name have been renamed in the module and hence they were failing with the message "No Callback Found"
    – Kumar A.
    Commented Sep 24, 2018 at 8:13
  • I have same error message "No callbacks found", I have checked my cronjob name in module, it is the same name everytime, still having this error message. Do you have any solution to fix this issue? Commented Dec 11, 2018 at 5:25
  • @RonakParmar Check your <job> tag in the xml file of the crontab. Both, "instance" and "method" properties must be specified and must be valid. The "instance" property must point to the file where the function to be executed exists and the "method" property must be the name of the function to be executed within that file. Commented Dec 13, 2018 at 13:48
  • @DanielKratohvil Thanks for assist. I have fixed my issue. I have used crontab.xml of Magento core module, and done required changes as per my custom module. Now my cron job is working fine. Thank you. Commented Dec 14, 2018 at 4:45
  • Thanks !! this works for me
    – Giordhano
    Commented Apr 16, 2019 at 20:49
4

I think you need to restart your cron service in Host Server

Commands for RHEL/Fedora/CentOS/Scientific Linux user

If you are using Redhat (RHEL)/Fedora/CentOS Linux use the following commands.

Task: Start cron service

To start the cron service, use:

# /etc/init.d/crond start

OR RHEL/CentOS 5.x/6.x user:

# service crond start

OR RHEL/Centos Linux 7.x user:

# systemctl start crond.service

Task: Stop cron service

To stop the cron service, use:

# /etc/init.d/crond stop

OR RHEL/CentOS 5.x/6.x user:

# service crond stop

OR RHEL/Centos Linux 7.x user:

# systemctl stop crond.service

Task: Restart cron service

To restart the cron service, use:

# /etc/init.d/crond restart

OR RHEL/CentOS 5.x/6.x user:

# service crond restart

OR RHEL/Centos Linux 7.x user:

# systemctl restart crond.service
1

The group with id "default" works with a period of every 15 minutes. Try to replace it with the "index":

...
 <group id="index">
...
1

You can use "which php" command to see the exact php path running on the server. Use that php path to configure by the SSH user used for the magento not by the root user.

Go to Magento installation and run

crontab -e

* * * * * path_to_php var/www/html/***.com/v2/bin/magento cron:run
* * * * * path_to_php var/www/html/***.com/v2/update/cron.php
* * * * * path_to_php var/www/html/***.com/v2/bin/magento setup:cron:run

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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