Using Command Line Interface

 

NAKIVO Backup & Replication allows you running actions from the product’s command line interface (CLI).

In case credentials are configured for the product, running an action via CLI requires providing administrator credentials as arguments, namely, --username [login] --password [password], where [login] is the administrator user name and [password] is the administrator password.

Operation Modes of Command Line Interface

You can run CLI in either of the following modes:

  • Interactive mode. This allows you to use a single login for a session. When opened in the interactive mode, CLI allows you executing commands without dashes.
    To open CLI in the interactive mode, enter cli.bat --interactive --username [login] --password [password] and press Enter. To exit the CLI interactive mode, enter Ctrl-C.

  • Non-interactive mode. This requires entering your credentials for each command. You will have to enter dashes before commands. For example: cli.bat --username [login] --password [password] --inventory-list

Using Command Line Interface Locally

To use CLI on the machine where NAKIVO Backup & Replication Director is installed, follow the steps below:

  1. Run the CLI executable:

    • If NAKIVO Backup & Replication is installed on a Windows OS, run the cli.bat file located in the bin folder inside the product installation folder ("C:\Program Files\NAKIVO Backup & Replication" by default).

    • If NAKIVO Backup & Replication is installed on a Linux OS, run the cli.sh file located in the director/bin folder inside the product installation folder (/opt/nakivo/ by default).

  2. Run available commands.

Using Command Line Interface Remotely

To use CLI from a remote machine, follow the steps below:

  1. Copy the CLI executable and .jar files to the machine from where you plan to use the CLI:

    • If NAKIVO Backup & Replication is installed on a Windows OS, copy the cli.bat and cli.jar files located in the bin folder inside the product installation folder ("C:\Program Files\NAKIVO Backup & Replication" by default).

    • If NAKIVO Backup & Replication is installed on a Linux OS, copy the cli.sh and cli.jar files located in the director/bin folder inside the product installation folder (/opt/nakivo/ by default).

  2. On the machine from where you plan to use the CLI, configure the PATH system variable as described at http://java.com/en/download/help/path.xml

  3. Run commands using the following format: <command> <host> <port> <username> <password>

Example

To get a list of jobs of the product which is installed on the machine with the 192.168.10.10 IP address, uses the 4443 port number for the Director Web HTTPS port, and has “admin” as login and password for the product’s web UI, run the following command: --job-list --host 192.168.10.10 --port 4443 --username admin --password admin

Using Command Line Interface in Multi-Tenant Mode

Triggering an action inside a tenant in the multi-tenant mode via command line interface requires providing a tenant ID as an argument:

cli.bat --repository-detach [repo_id] --username [login] --password [password] --tenant [tenant-id]