This is the first time I want to run cron for indexation every hour. I found multiple tutorials but none of them give me what I'm looking for or skip some steps.

I'm using OVH as a web hosting, Magento 2.3.

Help, please.

  • Please add more information to your question related to your requirement so one can help you here! Commented Jul 29, 2020 at 7:49

3 Answers 3


Please refer to the below documentation of OVh Web hosting to set automated tasks.


Example: Add the below code in your file you have set for schedule task:

//Assuming your file is in the Magento root folder.

<?php system('<path to php> <path to root>/bin/magento indexer:reindex') ?>


    $command = 'php /path-to-magento-root-directory/bin/magento indexer:reindex';
    echo '<pre>' . shell_exec($command) . '</pre>';

Also, check the below post if it is helpful!


More, take a look at Magento documentation to Configure and run cron


Hope this helps!

  • I alrady saw this, but my issue is what should I put on the the file added on ovh! Commented Aug 4, 2020 at 9:00
  • @Nouarizineb I have added an example in my answer. Add the code in your file and check if it works! Commented Aug 4, 2020 at 9:54
  • do you have any idea of the ovh php path plz? Commented Aug 4, 2020 at 10:02
  • @Nouarizineb run whereis php in terminal and it will show the path. Commented Aug 4, 2020 at 10:06
  • it gives me all of tha paths:php: /usr/local/bin/php.BETA /usr/local/bin/php /usr/local/bin/php.ORIG /usr/local/lib/php.ini-3 /usr/local/lib/php.ini-0 /usr/local/lib/php.ini /usr/local/lib/php /usr/local/lib/php.ini-2 /usr/local/lib/php.ini-1 /usr/local/php5.5 /usr/local/php5.6 /usr/local/php5.3 /usr/local/php7.0 /usr/local/php7.3 /usr/local/php7.1 /usr/local/php7.2 /usr/local/php5.4 /usr/local/php7.1/bin/php Commented Aug 4, 2020 at 10:14

add new cron in your crontab

 0 */1 * * *  /usr/bin/php  /YourMagentoInstallation/bin/magento indexer:reindex
  • where I should add this plz? Commented Aug 4, 2020 at 8:59
  • @Nouarizineb add your server crontab Commented Aug 4, 2020 at 11:08

use this cron expression

                <schedule><cron_expr>0 * * * *</cron_expr></schedule>

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.