Bitrix Commands
Bitrix operational commands are available under the bitrix section.
In the interactive menu, the daily Bitrix actions appear inside Applications -> Bitrix.
All commands require a site with bitrix profile.
Status
simai-admin.sh bitrix status --domain <domain>
Shows:
- core marker presence
.settings.phppresencedbconn.phppresenceBX_CRONTABmode (best effort fromdbconn.php)BX_CRONTAB_SUPPORTmode (best effort fromdbconn.php)cron_events.phpentrypoint presence- cron file/entry state with managed/domain/slug marker checks
- nginx upload body limit for Bitrix FileInput uploads (
client_max_body_size 64m) - nginx SEF fallback state for Bitrix URLs (
/bitrix/urlrewrite.php) - nginx static asset compression/cache hints for first page load performance
Cron Status
simai-admin.sh bitrix cron-status --domain <domain>
Read-only cron diagnostics for Bitrix (/etc/cron.d/<slug> + cron_events.php entry),
including simai-managed/domain/slug marker checks and the CLI short_open_tag=1
flag required by legacy Bitrix core files that still contain short PHP tags.
Cron Sync
simai-admin.sh bitrix cron-sync --domain <domain>
Rewrites the managed Bitrix cron file according to profile defaults.
Agents Status
simai-admin.sh bitrix agents-status --domain <domain>
Read-only status for “agents via cron” baseline:
BX_CRONTABBX_CRONTAB_SUPPORT- cron marker consistency for
/etc/cron.d/<slug> - CLI
short_open_tag=1marker in the cron command - combined readiness flag (
Agents via cron ready)
Agents Sync
simai-admin.sh bitrix agents-sync --domain <domain> [--apply yes] [--confirm yes]
- Default is plan-only (
--apply no). - Apply mode rewrites managed cron entry with
php -d short_open_tag=1 ... cron_events.phpand normalizesdbconn.phpconstants for web-safe cron mode (BX_CRONTABremoved,BX_CRONTAB_SUPPORT=true). - In CLI mode use
--confirm yeswith--apply yes. - Creates
dbconn.php.bak.<timestamp>before modification.
Cache Clear
simai-admin.sh bitrix cache-clear --domain <domain>
Clears Bitrix cache directories:
bitrix/cachebitrix/managed_cachebitrix/stack_cache
Ownership
simai-admin.sh bitrix ownership --domain <domain>
simai-admin.sh bitrix ownership --domain <domain> --apply yes --confirm yes
Checks and repairs root-owned files that can block Bitrix module install, uninstall, cache cleanup, and web-based file operations.
The command scans:
- the Bitrix docroot
- symlinked module targets under the managed SIMAI web/git paths
Repair mode changes web files to simai:www-data and git checkout targets to
simai:simai. Use this after restoring archives, running module installers
from a root shell, or repairing a deployment that left module files owned by
root.
DB Preseed
simai-admin.sh bitrix db-preseed --domain <domain> [--overwrite yes] [--short-install yes|no]
Generates Bitrix DB configuration files from site db.env:
public/bitrix/.settings.phppublic/bitrix/php_interface/dbconn.php
Notes:
- Safe for installer flow; no secrets are printed to console.
- By default it does not overwrite existing non-empty files.
- Use
--overwrite yesto force regeneration. - By default preseed writes
SHORT_INSTALL=trueintodbconn.phpto simplify Bitrix install flow. - Before SSL is enabled, open installer/status URLs over
http://, nothttps://. bitrixsetup.phpis downloaded best effort from the official Bitrix URL, but its current upstream behavior should be verified: if status reportsSetup kind = bitrix24-loader, do not treat it as a confirmed Site Management installer.- Preseed does not enable agents-via-cron by itself;
BX_CRONTAB_SUPPORTis added only by explicitbitrix agents-sync --apply yes. - Use
--short-install noif full/manual installer flow is required.
Installer Ready
simai-admin.sh bitrix installer-ready --domain <domain> [--overwrite yes] [--short-install yes|no] [--setup-overwrite yes|no] [--archive yes|no] [--edition start|standard|small-business|business] [--archive-overwrite yes|no] [--unpack yes|no]
Prepares Bitrix installer flow in one step:
- generates/updates DB preseed files from
db.env - downloads
public/bitrixsetup.phpfrom official Bitrix URL (best effort) - downloads a local Site Management distro archive (
.tar.gz) for the selected edition by default - unpacks the archive into docroot by default to expose the regular Site Management web installer at
/
Notes:
- default mode keeps existing files (
--overwrite no,--setup-overwrite no,--archive-overwrite no). - command is safe for repeat runs (idempotent).
- if network is unavailable, setup script step can fail while DB preseed still stays valid.
- default
--edition standardis used for a predictable fresh trial flow. - default
--unpack yesis recommended because current upstreambitrixsetup.phpmay behave as a generic Bitrix24 loader instead of a direct Site Management installer. - if
--unpack nois used, openbitrixsetup.php?test=1so BitrixSetup can work with the local distro archive. - recommended usage order for fresh sites:
site add --profile bitrix --db yesbitrix installer-ready --domain <domain>- complete web installer
bitrix finalize --domain <domain> --confirm yesssl letsencrypt --domain <domain> --email <email>(or usebitrix finalize --ssl yes --email <email>)
Notes:
bitrix statusnow probes the real web state and distinguishesinstaller,installed,placeholder, andunknown.- When unpacked distro files are present, the recommended installer URL is the site root
/, notbitrixsetup.php.
Restore Ready
simai-admin.sh bitrix restore-ready --domain <domain> [--overwrite yes] [--preseed auto|yes|no] [--short-install yes|no] [--archive auto|none|<filename>]
Prepares a Bitrix site for restore from an existing backup archive:
- downloads
public/restore.phpfrom the official Bitrix script URL - normalizes ownership and write permissions for restore-sensitive directories
- optionally writes
.settings.phpand connection initialization from sitedb.env; restore mode deliberately leavesdbconn.phpto the archive - validates every volume of an uploaded Bitrix
tar.gzbackup before printing the browser restore URL - prints the browser restore URL and the post-restore finalize command
Notes:
- This flow is for backup restore/migration. Use
installer-readyfor a fresh Bitrix install. --preseed autowrites restore-safe DB connection files only when site DB credentials are available. It does not create or overwritedbconn.php, because a premature UTF-8 marker can trigger obsoletembstring.func_overloadvalidation before a PHP 8-compatible archive is unpacked.--overwrite yesrefreshes an existingrestore.php.- With the default
--archive auto, run the command again after uploading all archive volumes. If no archive is present, it prints upload and validation steps instead of inviting the operator to open the wizard. - A missing or corrupt volume fails closed and names the first bad file.
--archive <filename>selects one base archive when several are present.--archive noneis an explicit advanced bypass. - After the browser restore wizard finishes, run
bitrix finalize --domain <domain> --confirm yes.
Finalize
simai-admin.sh bitrix finalize --domain <domain> --confirm yes [--ssl yes --email <email>] [--redirect yes|no] [--hsts yes|no] [--staging yes|no]
Safe post-install orchestration for Bitrix sites after the web installer has finished:
- verifies that Bitrix web installation is already complete (
web state = installed) - runs
bitrix php-baseline-sync - applies
bitrix agents-sync --apply yes - optionally issues Let’s Encrypt if
--ssl yes --email <email>is provided
Notes:
- In CLI mode
--confirm yesis required. - If the site is still in installer mode, the command stops with a clear error and prints the correct installer URL.
- This is the recommended single step after finishing the Bitrix web installer.
PHP Baseline Sync
simai-admin.sh bitrix php-baseline-sync --domain <domain>
simai-admin.sh bitrix php-baseline-sync --all yes --confirm yes
Applies Bitrix PHP INI baseline via site fix (--apply php-ini), with
--include-recommended yes by default.
Then enforces critical FPM keys per site:
memory_limit=512Mopcache.validate_timestamps=1opcache.revalidate_freq=0
Notes:
- Single-domain mode works with
--domain. - Bulk mode (
--all yes) requires--confirm yesin CLI mode. - Read-only checks are not changed; only PHP pool INI overrides are updated.
- run this after Bitrix web installation, before final
site_checker/perfmonacceptance checks.
Perf Status
simai-admin.sh bitrix perf-status --domain <domain>
Shows:
- managed site performance mode (
site perf-tunestate) - install stage (
installervspost-install) - Bitrix DB/runtime compatibility markers:
.settings.phpinit commandsafter_connect_d7.php- agents-via-cron readiness
- effective PHP-FPM runtime values used by Bitrix checker-sensitive paths
- cache directory presence
- Redis extension/service availability
Perf Apply
simai-admin.sh bitrix perf-apply --domain <domain> --mode standard --confirm yes
Supported modes:
standardhigh-load
Behavior:
- Applies a managed site PHP-FPM governance block (
balancedforstandard,aggressiveforhigh-load). - Runs
bitrix php-baseline-syncfor PHP/FPM runtime enforcement. - Applies
bitrix agents-syncautomatically only after installer stage is over (SHORT_INSTALL != true). - Clears Bitrix caches automatically only after installer stage is over.
Notes:
- Requires
--confirm yesoutside interactive menu. - Installer-stage Bitrix sites keep agents/cache steps in
skipped (installer)state by design.