Please provide me a solution with a code.
2 Answers
If you're using ubuntu you can open configured cron jobs by using command crontab -e
.
Now let's say you want to run indexer every minute, you can configure it like this
# m h dom mon dow command
*/01 * * * * /usr/bin/php /var/www/html/magento2/bin/magento indexer:reindex
-
1This is not the solution. Why would you reindex everything every minute, negating the benefits of the indexes? See Akhilesh comment with link to Magento docs on how to set it up. Aug 2, 2018 at 8:14
-
This was just an example as mentioned in the answer. Of course you have to keep it's impact in mind and set time accordingly. Aug 2, 2018 at 9:56
There is a whole section in the magento develop docs which discuss how to go about setting up the cron and the different scenarios
https://devdocs.magento.com/guides/v2.3/config-guide/cli/config-cli-subcommands-cron.html
The only difference is that you would use php bin/magento index:reindex
If you are still stuck you could reach out to your host. If you get someone good they might help you out with what do do that's specific to who you are using.