The cpanel_dovecot_solr_rebuild_index Script

Valid for versions 82 through the latest version



Last modified: July 28, 2022


The /usr/local/cpanel/3rdparty/scripts/cpanel_dovecot_solr_rebuild_index script rebuilds your Apache Solr™ index files if they become corrupt. This script performs the following actions:

  1. Backs up the existing index files to the /home/cpanelsolr/server/solr/dovecot/data/index/segments_1.timestamp file.


    In this filepath, timestamp represents the file’s creation date and time.

  2. Restarts Apache Solr.

  3. Reindexes all of your cPanel users’ mailboxes.

    • To run this script, you must install Apache Solr. To install Apache Solr, use WHM’s Manage Plugins interface (WHM » Home » cPanel » Manage Plugins).

    • On systems with many user mailboxes, this script may become resource intensive and slow to complete.

The system runs the /usr/local/cpanel/3rdparty/scripts/cpanel_dovecot_solr_maintenance script nightly via cron job. This script ensures that Apache Solr runs efficiently. It optimizes your Apache Solr index files to improve searching and removes space that deleted emails use.

This script fails when your Apache Solr index files become corrupt, which commonly occurs on resource-limited systems. For example, if you run out of disk space or inodes, Apache Solr’s index files can become corrupt. If the script fails, the system sends you an email with the error and steps to troubleshoot the error. If you troubleshoot the error and the script continues to fail, use the /usr/local/cpanel/3rdparty/scripts/cpanel_dovecot_solr_rebuild_index script to rebuild your Apache Solr index files.

Run the script

To use this script, run the following command as the root user:



This script does not accept options.


The --help option will not provide help documentation. Instead, the script will run as if you did not pass an option.

For more information about Apache Solr, read’s Solr documentation.

Additional Documentation