We have an issue on our website where the search functionality periodically stops working. I'm not sure why but when we re-index * Catalog Search Index* & Category Products it works again.

One solution we would like to use is to re-index these each night. At them moment we have this in our crontab.

*/5 * * * * /bin/sh /var/www/magento-root/cron.sh
30 4 * * * /var/www/magento-root/rediscli.php -s -p 6379 -d 1

Do I just need add the following to it:

30 2 * * * php -q /var/www/magento-root/shell/indexer.php --reindex catalog_category_product,catalogsearch_fulltext

I'm not too familiar with CRONTABS

  • which hosting provider are you using
    – Amit Bera
    Commented Jan 11, 2017 at 12:03
  • we're using a AWS EC2 instance on Ubuntu
    – Holly
    Commented Jan 11, 2017 at 12:18

1 Answer 1


Your cron expression is correct, 30 2 * * * will run every day at 2:30am.

I'd make some amendments to the crontab you've put and have it as follows:

30 2 * * * ! test -e /path/to/magento/maintenance.flag && php -q /path/to/magento/shell/indexer.php --reindex catalog_category_product,catalogsearch_fulltext >> /path/to/magento/var/log/cron.log;


30 2 * * * ! test -e /path/to/magento/maintenance.flag &&

Will test for the maintenance flag and will stop the script from running if it's enabled (Good practise to have this on all crons you have defined)

php -q /path/to/magento/shell/indexer.php --reindex catalog_category_product,catalogsearch_fulltext

Run the script via PHP.

>> /path/to/magento/var/log/cron.log;

Echo the output of the script to the cron.log file, helps to ensure it is running correctly.

I tend to use: https://crontab.guru/ if I need to make references to any crontab expressions.

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.