Magento2 Cron Job Not Running Automatically – Troubleshooting Guide

cronmagento-cronmagento2

I am trying to implement cron job to write a log file with 1min interval. I have an issue while doing the same. I notice that cron job is not running automatically.

Each time when I run "PHP bin/Magento cron: run " then only cron job gets executed and the database gets populated. If each time I need to run that command then it does not serve as the purpose of corn job.

I follow this link to implement:

https://devdocs.magento.com/guides/v2.2/config-guide/cron/custom-cron-tut.html

Please help me for the same

Best Answer

Try this:

just run this command in terminal crontab -e then paste below code in terminal.

* * * * * <path to php binary> <magento install dir>/bin/magento cron:run 

After pasting that code press CTRL + X key then you will see this message.

Save modified buffer (ANSWERING "No" WILL DESTROY CHANGES) ?

Now press Y now you will see this type of message.

File Name to Write: /tmp/{{you will see temp name}}/crontab Just press ENTER And cron set.

It will call every minute Magento cron and Magento will manage your extension's cron and run as per configured time.

After cron configuration you just need to flush the cache.