Skip to main content

CLI and scheduled reindexing

Add a task from the admin panel​

Open Индексация и проверка → Переиндексация по cron. Select all data, products or sections; daily at a chosen time, hourly, every 15 minutes or every 5 minutes; and optionally a time budget per run.

Click Установить / обновить задание (Install/update task). The same block has task removal and status refresh buttons. These actions apply immediately, independently of the general Save button. Cron uses saved catalog and field settings.

Admin-panel management requires:

  • Bitrix administrator access;
  • site PHP running as the OS user bitrix;
  • POSIX, available proc_open, executable /usr/bin/php and crontab, and permission to manage that user's crontab.

A site administrator account is not the PHP process's OS user. If web PHP runs as another user, the panel shows the reason and a command for manual setup. The module does not use sudo or modify another user's crontab.

Manual setup​

Open the user crontab with crontab -e as bitrix. Example: a full pass every day at 03:00.

0 3 * * * /usr/bin/php /home/bitrix/www/bitrix/modules/zorka.search/tools/reindex.php /home/bitrix/www --cron --scope=all --batch=1000

Replace /home/bitrix/www with the real site root in both places and verify the PHP CLI path and version. Schedules use server time. Do not add a username to a user crontab entry. In a hosting panel, enter the schedule separately and start the command with /usr/bin/php.

To process work in bounded runs every five minutes:

*/5 * * * * /usr/bin/php /home/bitrix/www/bitrix/modules/zorka.search/tools/reindex.php /home/bitrix/www --cron --scope=products --batch=1000 --max-time=240

An unfinished pass resumes at the next run. Once completed, the next run starts a new pass; consider this when choosing frequency. You can test the command in the site user's shell before scheduling it.

CLI options​

/usr/bin/php /home/bitrix/www/bitrix/modules/zorka.search/tools/reindex.php /home/bitrix/www --scope=sections --batch=300
OptionMeaning
--scope=all, products or sectionsScope; default all
--batch=1..1000Objects per batch; default 300
Neither --resume nor --cronStart a new pass for the selected scope
--resumeResume an unfinished pass; fail if none exists
--cronResume, start after completion, or restart after settings change
--max-time=240Save progress and stop between batches after roughly 240 seconds; 0 means no limit

Do not combine --cron and --resume. The time limit is soft: the current object and final cleanup may take longer. PHP CLI and server limits must also allow the task to run.

Concurrent runs and logs​

A shared CLI lock covers all scopes of one index. An overlapping cron run is skipped with busy and exit code 0; an overlapping manual run exits with 75. Browser runs cannot change the running CLI's cursor. Search and queued updates can operate between batches.

Output consists of JSON lines with started, resumed, completed, paused, busy or error events; manual runs also report progress. Exit code 0 means completion, a saved pause, or a skipped busy cron run. Only completed confirms the pass finished. Errors exit with 1. Use cron mail or a private server log, not a publicly accessible site file.

Changes managed by the module​

The form manages only its marked block in the bitrix user's crontab, separately for each real site root. Other jobs and /etc/crontab remain untouched. This is a separate schedule, not a replacement for native Bitrix agent execution.

Uninstallation removes the managed block when crontab access is still available. Otherwise it asks you to remove the job manually. Jobs added manually outside that block are not removed by the module.