Usage
General syntax
All Dolicli commands follow the same structure:
./dolibarr <category> <command> [parameters] [options]
- Parameters are passed in the form
key=value - Options (flags) are prefixed with
--(for example--force,--help)
Built-in help
Each command has help accessible with --help:
./dolibarr user add --help
./dolibarr repair run --help
./dolibarr system upgrade --help
To display the list of all command categories, run Dolicli without argument:
./dolibarr
To display the sub-commands of a category, indicate only the category:
./dolibarr user
./dolibarr module
./dolibarr system
User management
Listing users
./dolibarr user list
Displays a table with the login, last name, first name and email address of each user.
Showing a user's details
./dolibarr user show login=admin
Displays the complete information: identity, contact details, status, rights, login dates, groups and address.
Creating a user
./dolibarr user add login=jdupont firstname=Jean lastname=Dupont
Required parameters: login, firstname, lastname.
Optional parameters:
| Parameter | Description | Default |
|---|---|---|
password |
Password (asked interactively if absent) | - |
email |
Email address | empty |
admin |
Administrator rights (0 or 1) |
0 |
Complete example:
./dolibarr user add login=jdupont firstname=Jean lastname=Dupont password=MyPass123 email=jean@example.com admin=0
Changing a password
./dolibarr user password login=admin newpass=NewPassword
If the newpass parameter is omitted, the password is asked interactively.
The --force option disables Dolibarr's password security rules:
./dolibarr user password login=admin --force
Locking or unlocking an account
./dolibarr user edit login=jdupont --lock
./dolibarr user edit login=jdupont --unlock
Generating an API token
./dolibarr user token login=admin
If a token already exists, the command displays a warning and stops. Use --force to regenerate a new token:
./dolibarr user token login=admin --force
The generated token is displayed only once. Keep it safe.
Module management
Listing modules
./dolibarr module list
Displays a table with the identifier, name, version, external character, visibility, update need and publisher of each module.
Enabling a module
./dolibarr module activate name=modFacture
The name parameter corresponds to the module's technical name (for example modFacture, modSociete, modUser).
To enable all available modules:
./dolibarr module activate --all
Warning: enabling all modules can cause conflicts. Use this option with caution, for example on a test environment.
Disabling a module
./dolibarr module deactivate name=modFacture
To disable all active modules (except the critical modUser and modSysLog modules):
./dolibarr module deactivate --all
System management
Upgrading Dolibarr
Checking available updates
./dolibarr system upgrade --check
Listing available versions
./dolibarr system upgrade --list
Minor upgrade
Updates to the latest minor version of the current branch (for example 21.0.3 to 21.0.5):
./dolibarr system upgrade --minor
Major upgrade
Updates to the latest major version available:
./dolibarr system upgrade --major
Upgrade to a specific version
./dolibarr system upgrade --version=22.0.0
Database migration only
If you have already updated the files manually, run only the database migration:
./dolibarr system upgrade
The --force option forces the migration even if the versions seem compatible. The --skip-backup option skips the backup confirmation request.
Warning: always back up your database before any upgrade. Test on a pre-production environment for major upgrades.
Maintenance mode
Checking the status
./dolibarr system maintenance status
Enabling maintenance mode
./dolibarr system maintenance enable
./dolibarr system maintenance enable login=admin
Without the login parameter, the first super-administrator found is used.
Disabling maintenance mode
./dolibarr system maintenance disable
Warning: do not log out of your session before disabling maintenance mode, on pain of no longer being able to access Dolibarr.
Scheduled tasks security key (CRON_KEY)
The CRON_KEY constant is the value of the securitykey parameter required in the URL public/cron/cron_run_jobs.php?securitykey=... when triggering scheduled tasks over HTTP. It is stored in the llx_const table and respects the current entity in multi-company mode.
Showing the current key
./dolibarr system cronkey show
Setting a specific key
./dolibarr system cronkey set key=mySecretKey
The provided value overwrites the existing key.
Generating a random key
./dolibarr system cronkey generate
Generates a 32-character hexadecimal key (16 random bytes) and saves it. The new value is displayed at the end of the command.
Deleting the key
./dolibarr system cronkey clear
Deletes the CRON_KEY constant. No security key is then required to trigger the scheduled tasks.
Warning: if you modify or delete the key, remember to update the system cron task (crontab, scheduler, etc.) that calls
cron_run_jobs.php, on pain of seeing the scheduled tasks fail with an invalid key error.
Database repair
Running a repair action
./dolibarr repair run action=ACTION [mode=test|confirmed]
The test mode (default) shows what would be done without modifying the database. The confirmed mode actually executes the repair.
Available actions
| Action | Description |
|---|---|
standard |
Runs the SQL repair scripts and synchronizes extrafields |
force_disable_modules |
Disables modules whose files are not found |
restore_logos |
Restores third-party logos |
restore_pictures |
Restores user photos |
rebuild_thumbs |
Rebuilds product thumbnails |
clean_linked_elements |
Cleans the linked elements table |
clean_menus |
Cleans the menus table |
clean_orphan_dirs |
Deletes orphan directories |
clean_stock_batch |
Cleans the product stock batch table |
clean_permissions |
Cleans the permissions table |
set_time_spent |
Initializes empty time-spent amounts |
force_utf8 |
Forces UTF-8 encoding on tables (MySQL/MariaDB) |
force_utf8mb4 |
Forces UTF-8 MB4 encoding on tables (MySQL/MariaDB) |
rebuild_sequences |
Rebuilds sequences (PostgreSQL) |
repair_dispatch_links |
Repairs links between receptions and supplier orders |
Example:
./dolibarr repair run action=clean_menus mode=test
./dolibarr repair run action=clean_menus mode=confirmed
Maintenance mode is automatically enabled during the repair execution, then disabled at the end.
Third-party management
Listing third parties
./dolibarr thirdparty list
Optional parameters:
| Parameter | Description |
|---|---|
limit=N |
Limits the number of results |
offset=N |
Offsets the results (pagination) |
search=text |
Filters by third-party name |
Example:
./dolibarr thirdparty list limit=10 search=Dupont
Recalculating accounting codes
./dolibarr thirdparty accountingnumber
Recalculates each third party's (customers and prospects) customer accounting code according to the numbering rules configured in Dolibarr. Displays a table with the old and the new code.
Warning: this command directly modifies the accounting codes in the database. The script stops at the first error encountered.
Backup
Exporting the database
./dolibarr backup --database
Generates an SQL file via mysqldump in the system's temporary directory.
Exporting documents
./dolibarr backup --documents
Creates a ZIP archive of Dolibarr's data directory (.log files are excluded).
Exporting modules
./dolibarr backup --modules
Creates a ZIP archive of Dolibarr's htdocs/ directory.
Choosing the destination directory
./dolibarr backup --database dir=/path/to/backups
Files are named after the current date: YYYYMMDD-database.sql, YYYYMMDD-documents.zip, YYYYMMDD-modules.zip.
Anonymization
Preview (dry run)
./dolibarr anonymize run
Displays a summary of what would be anonymized, without modifying the database.
Execution
./dolibarr anonymize run --confirm
An interactive confirmation (YES in uppercase) is requested before execution. Maintenance mode is automatically enabled during the operation.
Options
| Option | Description |
|---|---|
--confirm |
Actually executes the anonymization (required) |
--skip-thirdparties |
Ignore third parties and contacts |
--skip-users |
Ignore user accounts |
--skip-members |
Ignore members |
--skip-bank |
Ignore bank data |
keep-admin=LOGIN |
Login of the administrator to preserve (by default: first super-admin) |
Anonymized data
- Third parties: names, addresses, phones, emails, SIREN/SIRET, VAT
- Contacts: names, addresses, phones, emails, dates of birth
- Users: names, logins, emails, phones, addresses, salaries, API keys
- Members: names, emails, phones, addresses, identifiers
- Bank data: IBAN, BIC, account numbers, card details
- Communications: email addresses, subjects, contents, IP addresses
- Mailings: recipients' names and emails
- Employment contracts: salary data
- Email collectors: identifiers and passwords
- Notes: all
note_privateandnote_publicfields - Locked log and sessions: fully purged
Data not anonymized
- Financial amounts (invoice totals, order amounts)
- Document references (FA2024-001, etc.)
- Product catalog
- The administrator account specified by
keep-admin - Files on disk (documents, attachments)
- Extrafields (custom fields)
Warning: anonymization is irreversible. Always make a full backup of your database before running this command.