XP commands
Contents
The following commands are used when communicating directly with an Enonic XP instance. For these commands to work, the CLI must have access to the management API of your XP instance.
Environment variables
Enonic CLI communicates with XP’s management API which require both endpoint details and credentials to be defined. These parameters may be specified directly via command line, but it is recommended to specify these as environment variables instead.
Use the following environment variables in your terminal to simplify the communication with XP:
Option | Description |
---|---|
|
URL of the running enonic XP instance ( Default is |
|
User name for authentication in enonic XP |
|
User password for authentication in enonic XP |
|
URL of proxy server to use |
Credentials passed via command line overrides the environment variables. |
Snapshot
List of commands for manipulating repository snapshots can be seen by typing:
$ enonic snapshot Create and restore snapshots USAGE: Enonic CLI snapshot command [command options] [arguments...] COMMANDS: list, ls Returns a list of existing snapshots with name and status. create Stores a snapshot of the current state of the repository. restore Restores a snapshot of a previous state of the repository. delete, del Deletes snapshots, either before a given timestamp or by name. OPTIONS: --help, -h show help
Create
Create a snapshot of all or a single repository while running. The snapshots will be stored in the directory given in snapshots.dir
option in the Repo Configuration (default $xp_home/snapshots). Note that the first snapshot only stores markers in the repository for the current state. Subsequent snapshots stores the changes since the last snapshot. See Backup and Restore for more information on snapshots.
For a clustered installation, the snapshot-location must be on a shared file-system. |
$ enonic snapshot create [-r <value>] [-a <value>]
Options:
Option | Description |
---|---|
|
authentication token for basic authentication (user:password). |
|
the name of the repository to snapshot. |
|
accept default answers to all prompts and run non-interactively |
if auth param is missing and there is no valid session CLI will look for ENONIC_CLI_REMOTE_USER and ENONIC_CLI_REMOTE_PASS environment variables. See configuration section. |
$ enonic snapshot create -a su:password -r cms-repo
List
List all the snapshots for the installation. See Backup and Restore for more information on snapshots.
$ enonic snapshot ls
Options:
Option | Description |
---|---|
|
authentication token for basic authentication (user:password). |
|
accept default answers to all prompts and run non-interactively |
if auth param is missing and there is no valid session CLI will look for ENONIC_CLI_REMOTE_USER and ENONIC_CLI_REMOTE_PASS environment variables. See configuration section. |
Restore
Restore a named snapshot. See Backup and Restore for more information on snapshots.
$ enonic snapshot restore [--snap <value>] [--repo <value>] [-a <value>] [-f]
Options:
Option | Description |
---|---|
|
snapshot name to restore |
|
the name of the repository to restore |
|
authentication token for basic authentication (user:password). |
|
accept default answers to all prompts and run non-interactively |
if auth param is missing and there is no valid session CLI will look for ENONIC_CLI_REMOTE_USER and ENONIC_CLI_REMOTE_PASS environment variables. See configuration section. |
Delete
Deletes a snapshot by name or date:
$ enonic snapshot delete [-before <value>] [--snap <value>] [-a <value>] [-f]
Options:
Option | Description |
---|---|
|
"2 Jan 06" formatted date to delete snapshots up to |
|
snapshot name to delete |
|
authentication token for basic authentication (user:password). |
|
accept default answers to all prompts and run non-interactively |
if auth param is missing and there is no valid session CLI will look for ENONIC_CLI_REMOTE_USER and ENONIC_CLI_REMOTE_PASS environment variables. See configuration section. |
Dump
List of command for manipulating all repositories can be seen by typing:
$ enonic dump Dump and load complete repositories USAGE: Enonic CLI dump command [command options] [arguments...] COMMANDS: create Export data from every repository. upgrade, up Upgrade a dump. load Import data from a dump. list, ls List available dumps OPTIONS: --help, -h show help
Create
Export data from every repository. The result will be stored in the $XP_HOME/data/dump
directory.
$ enonic dump create [-d <value>] [--skip-versions <value>] [--max-version-age <value>] [--max-versions <value>] [-a <value>] [-f]
Options:
Option | Description |
---|---|
|
dump name |
|
don’t dump version-history, only current versions included |
|
max age of versions to include, in days, in addition to current version |
|
max number of versions to dump in addition to current version |
|
outputs dump output to an archive (%name%.zip) file (default is false) |
|
authentication token for basic authentication (user:password). |
|
accept default answers to all prompts and run non-interactively |
if auth param is missing and there is no valid session CLI will look for ENONIC_CLI_REMOTE_USER and ENONIC_CLI_REMOTE_PASS environment variables. See configuration section. |
$ enonic dump create -a su:password -d myDump
Upgrade
Upgrade a data dump from a previous version to the current version. The output of the upgrade will be placed alongside the dump that is being upgraded and will have the name <dump-name>_upgraded_<new-version>
.
The current version XP installation must be running with the upgraded app deployed. |
$ enonic dump upgrade [-d <value>] [-a <value>] [-f]
Options:
Option | Description |
---|---|
|
dump name |
|
authentication token for basic authentication (user:password). |
|
accept default answers to all prompts and run non-interactively |
if auth param is missing and there is no valid session CLI will look for ENONIC_CLI_REMOTE_USER and ENONIC_CLI_REMOTE_PASS environment variables. See configuration section. |
$ enonic dump upgrade -a su:password -d myDump
List
Lists all the dumps
$ enonic dump ls [-a <value>] [-f]
Options:
Option | Description |
---|---|
|
authentication token for basic authentication (user:password). |
|
accept default answers to all prompts and run non-interactively |
if auth param is missing and there is no valid session CLI will look for ENONIC_CLI_REMOTE_USER and ENONIC_CLI_REMOTE_PASS environment variables. See configuration section. |
Load
Load data from a named system dump into Enonic XP. The dump read has to be stored in the $XP_HOME/data/dump
directory. See Export and Import for more information on system dump/load.
A load will delete all existing repositories before loading the repositories present in the system-dump |
$ enonic dump load [-d <value>] [--upgrade] [-a <value>] [-f]
Options:
Option | Description |
---|---|
|
dump name to load |
|
upgrade the dump if necessary (default is false) |
|
loads dump form an archive (%name%.zip) file (default is false) |
|
authentication token for basic authentication (user:password) |
|
accept default answers to all prompts and run non-interactively |
if auth param is missing and there is no valid session CLI will look for ENONIC_CLI_REMOTE_USER and ENONIC_CLI_REMOTE_PASS environment variables. See configuration section. |
$ enonic dump load -a su:password -d newDump -f --upgrade
Export
Extract data from a given repository, branch and content path. The result will be stored in the $XP_HOME/data/export
directory. This is useful to move a part of a site from one installation to another. See Export and Import for more information on content export/import.
Exporting content will not include the version history of the content, just the current version. |
To list available configuration options, type:
$ enonic export -h Export data from a given repository, branch and content path. USAGE: enonic export [command options] [arguments...] OPTIONS: -t value Target name to save export. --path value Path of data to export. Format: <repo-name>:<branch-name>:<node-path> e.g. 'cms-repo:draft:/' --skip-ids Flag to skip ids in data when exporting. --skip-versions Flag to skip versions in data when exporting. --dry Show the result without making actual changes. --auth value, -a value Authentication token for basic authentication (user:password) -f, --force Accept default answers to all prompts and run non-interactively
if auth param is missing and there is no valid session CLI will look for ENONIC_CLI_REMOTE_USER and ENONIC_CLI_REMOTE_PASS environment variables. See configuration section. |
$ enonic export -a su:password -t myExport --path cms-repo:draft:/some-content
Import
Import data from a named export into Enonic XP at the desired content path. The export has to be stored in the $XP_HOME/data/export
directory. See Export and Import for more information on content export/import.
To list available configuration options, type:
$ enonic import -h Import data from a named export. USAGE: enonic import [command options] [arguments...] OPTIONS: -t value A named export to import. --path value Target path for import. Format: <repo-name>:<branch-name>:<node-path> e.g. 'cms-repo:draft:/' --xsl-source value Path to xsl file (relative to <XP_HOME>/data/export) for applying transformations to node.xml before importing. --xsl-param value Parameters to pass to the XSL transformations before importing nodes. Format: <parameter-name>=<parameter-value> e.g. 'applicationId=com.enonic.myapp' --skip-ids Flag to skips ids when importing --skip-permissions Flag to skips permissions when importing --dry Show the result without making actual changes. -a value, --auth value Authentication token for basic authentication (user:password) -f, --force Accept default answers to all prompts and run non-interactively
if auth param is missing and there is no valid session CLI will look for ENONIC_CLI_REMOTE_USER and ENONIC_CLI_REMOTE_PASS environment variables. See configuration section. |
$ enonic import -a su:password -t myExport --path cms-repo:draft:/some-content
An XSL file and a set of name=value parameters can be optionally passed for applying transformations to each node.xml file, before importing it. This option could for example be used for renaming types or fields. The .xsl file must be located in the |
App
Commands to install applications to the running enonic XP instance. Currently only one command is available here:
$ enonic app Install, stop and start applications USAGE: Enonic CLI app command [command options] [arguments...] COMMANDS: install, i Install an application from URL or file OPTIONS: --help, -h show help
Install
Installs an application on all nodes.
$ enonic app install [--url <value>] [--file <value>] [-a <value>] [-f]
Options:
Option | Description |
---|---|
|
the URL of the application |
|
path to an application file (mutually exclusive with url, used if both are present) |
|
authentication token for basic authentication (user:password) |
|
accept default answers to all prompts and run non-interactively |
if auth param is missing and there is no valid session CLI will look for ENONIC_CLI_REMOTE_USER and ENONIC_CLI_REMOTE_PASS environment variables. See configuration section. |
$ enonic app install -a su:password --url https://repo.enonic.com/public/com/enonic/app/superhero/2.0.5/superhero-2.0.5.jar
$ enonic app install -a su:password --file /Users/nerd/Dev/apps/coolapp/build/libs/coolapp-1.0.0-SNAPSHOT.jar
Start
Start application on all nodes.
$ enonic app start <app key> [-a <value>] [-f]
Options:
Option | Description |
---|---|
|
application key |
|
authentication token for basic authentication (user:password) |
|
accept default answers to all prompts and run non-interactively |
if auth param is missing and there is no valid session CLI will look for ENONIC_CLI_REMOTE_USER and ENONIC_CLI_REMOTE_PASS environment variables. See configuration section. |
com.enonic.app.superhero
app:
$ enonic app start com.enonic.app.superhero -a su:password
Stop
Stop application on all nodes.
$ enonic app stop <app key> [-a <value>] [-f]
Options:
Option | Description |
---|---|
|
application key |
|
authentication token for basic authentication (user:password) |
|
accept default answers to all prompts and run non-interactively |
if auth param is missing and there is no valid session CLI will look for ENONIC_CLI_REMOTE_USER and ENONIC_CLI_REMOTE_PASS environment variables. See configuration section. |
com.enonic.app.superhero
app:
$ enonic app stop com.enonic.app.superhero -a su:password
Repo
Commands for configuring and managing repositories. Full list is available by typing:
$ enonic repo Tune and manage repositories USAGE: Enonic CLI repo command [command options] [arguments...] COMMANDS: reindex Reindex content in search indices for the given repository and branches. readonly Toggle read-only mode for server or single repository replicas Set the number of replicas in the cluster. list, ls List available repos OPTIONS: --help, -h show help
Reindex
Reindex the content in the search indices for the given repository and branches. This is usually required after upgrades, and may be useful in many other situation.
$ enonic repo reindex [--b <value, value...>] [-r <value>] [-i] [-a <value>] [-f]
Options:
Option | Description |
---|---|
|
a comma-separated list of branches to be reindexed |
|
the name of the repository to reindex |
|
if true, the indices will be deleted before recreated |
|
authentication token for basic authentication (user:password) |
|
accept default answers to all prompts and run non-interactively |
if auth param is missing and there is no valid session CLI will look for ENONIC_CLI_REMOTE_USER and ENONIC_CLI_REMOTE_PASS environment variables. See configuration section. |
$ enonic repo reindex -a su:password -b draft,master -i -r cms-repo
Readonly
Toggle read-only mode. In read-only mode, no changes can be made on the server, or a single repo if specified
$ enonic repo readonly [readOnly] [-r <value>] [-a <value>] [-f]
Options:
Option | Description |
---|---|
|
boolean value to set |
|
single repository to toggle read-only mode for |
|
authentication token for basic authentication (user:password) |
|
accept default answers to all prompts and run non-interactively |
if auth param is missing and there is no valid session CLI will look for ENONIC_CLI_REMOTE_USER and ENONIC_CLI_REMOTE_PASS environment variables. See configuration section. |
$ enonic repo readonly true -a su:password -r cms-repo
Replicas
Set the number of replicas in the cluster. For more information on how replicas work and recommended values, see: Replica setup.
$ enonic repo replicas [replicasNum] [-a <value>] [-f]
Options:
Option | Description |
---|---|
|
whole number between 1 and 99 to set |
|
authentication token for basic authentication (user:password) |
|
accept default answers to all prompts and run non-interactively |
if auth param is missing and there is no valid session CLI will look for ENONIC_CLI_REMOTE_USER and ENONIC_CLI_REMOTE_PASS environment variables. See configuration section. |
$ enonic repo replicas 3 -a su:password
List
List available repositories.
$ enonic repo list [-a <value>] [-f]
Options:
Option | Description |
---|---|
|
authentication token for basic authentication (user:password) |
|
accept default answers to all prompts and run non-interactively |
if auth param is missing and there is no valid session CLI will look for ENONIC_CLI_REMOTE_USER and ENONIC_CLI_REMOTE_PASS environment variables. See configuration section. |
$ enonic repo list -a su:password
Cms
Content metadata commands. Currently only one command present here:
$ enonic cms CMS commands USAGE: Enonic CLI cms command [command options] [arguments...] COMMANDS: reprocess Reprocesses content in the repository. OPTIONS: --help, -h show help
Reprocess
Reprocesses content in the repository and regenerates metadata for the media attachments. Only content of a media type (super-type = base:media) are processed.
Unless the –skip-children
flag is specified, it processes all descendants of the specified content path.
This command should be used after migrating content from Enonic CMS using the cms2xp tool. |
$ enonic cms reprocess [--path <value>] [--skip-children] [-a <value>] [-f]
Options:
Option | Description |
---|---|
|
target content path to be reprocessed. Format: |
|
flag to skip processing of content children |
|
authentication token for basic authentication (user:password) |
|
accept default answers to all prompts and run non-interactively |
if auth param is missing and there is no valid session CLI will look for ENONIC_CLI_REMOTE_USER and ENONIC_CLI_REMOTE_PASS environment variables. See configuration section. |
$ enonic reprocess -a su:password -s draft:/some-content
System
System tasks show info about currently running enonic XP instance. Currently there is only one command as can be seen by running:
$ enonic system System commands USAGE: Enonic CLI system command [command options] [arguments...] COMMANDS: info, i XP distribution info OPTIONS: --help, -h show help
Info
Shows info about currently running enonic XP instance.
$ enonic system info { "Version": "7.2.0", "Installation": "demo", "RunMode": "PROD", "Build": { "Hash": "39d4b215fd2009d7ba65e07efc54ebad50638741", "ShortHash": "39d4b21", "Branch": "master", "Timestamp": "2019-12-19T15:18:13Z" } }
Auditlog
List of commands for managing audit log repository can be seen by typing:
$ enonic auditlog Manage audit log repository USAGE: Enonic CLI auditlog command [command options] [arguments...] COMMANDS: cleanup Deletes records from audit log repository. OPTIONS: --help, -h show help
Cleanup
Deletes records from audit log repository.
$ enonic auditlog cleanup
Options:
Option | Description |
---|---|
|
age of records to be removed. |
|
authentication token for basic authentication (user:password) |
|
accept default answers to all prompts and run non-interactively |
$ enonic auditlog cleanup --age P30D
Vacuum
Permanently removes old versions and deleted items from disk.
To support snapshot restore
and a rich version history, XP does not physically remove the data from disk. The side-effect is that the disk usage will keep growing, even if you delete nodes from the repository. Vacuum command permanently removes old unused versions, as well as deleted nodes from disk. XP defines a default threshold of 21 days (configurable). This basically means that only items deleted at least 21 days ago, or version that are older than 21 days will be vacuumed.
Using the -b option will remove the underlying blobs, meaning restoring a snapshot that is older than 21 days (since last vacuum) will result in an inconsistent and broken dataset. |
To list available configuration options, type:
$ enonic vacuum -h Removes old version history and segments from content storage. USAGE: enonic vacuum [command options] [arguments...] OPTIONS: --blob, -b Also removes unused blobs --auth value, -a value Authentication token for basic authentication (user:password) --force, -f Accept default answers to all prompts and run non-interactively
if auth param is missing and there is no valid session CLI will look for ENONIC_CLI_REMOTE_USER and ENONIC_CLI_REMOTE_PASS environment variables. See configuration section. |
$ enonic vacuum -b