The command line options for the Command Control module allow you to perform the following tasks:
The following commands allow you to export a current command control configuration and import one. Importing a configuration overwirtes any existing rule set; therefore before importing a configuration, you should back up the current configuration (see Section 10.2.2, Backing Up and Restoring a Command Control Configuration).
The export command has the following syntax:
Syntax: ./unifi -n cmdctrl export [options]
If you have not mapped your local account to a Framework Manager user (see Modify User: Native Maps), replace the -n option with -u <username> -p <password> options and specify the name and password of a Framework Manager user who has the rights to perform this task.
Replace [options] with one or more of the following:
Options |
Description |
---|---|
-f <arg> |
Specifies where to export the configuration to. Replace <arg> with a filename or a path and filename. |
-c |
Specifies that the configuration should be exported in clear text. This option cannot be used with the -p option. |
-p <pwd> |
Specifies an encryption password for the file. If a password is specified, the password must be entered when importing the file. This option cannot be used with the -c option. |
The import command has the following syntax:
Linux Syntax: ./unifi -n cmdctrl import [options]
If you have not mapped your local account to a Framework Manager user (see Modify User: Native Maps), replace the -n option with -u <username> -p <password> options and specify the name and password of a Framework Manager user who has the rights to perform this task.
Replace [options] with one or more of the following:
Options |
Description |
---|---|
-f <arg> |
Specifies the file to import. Replace <arg> with a filename or a path and filename. |
-p <pwd> |
Specifies the password that was used to encrypt the configuration when it was exported. |
The following commands can be executed on the primary console or on backup hosts. When they are executed on a backup host, the commands actually execute on the primary console.
Syntax: ./unifi -n cmdctrl [option]
If you have not mapped your local account to a Framework Manager user (see Modify User: Native Maps), replace the -n option with -u <username> -p <password> options and specify the name and password of a Framework Manager user who has the rights to perform this task.
Replace [option] with one of the following:
Option |
Description |
---|---|
backup -t <"reason"> |
Backs up the current command control database. The -t <“reason”> parameter allows you to supply a reason for the backup, and is optional but recommended. Enclose the reason text in double quotes. |
listcfg <format> |
Lists the backups that are available for restoration. To specify a format, use one of the following: -x: For XML output. For example: <a.Item I.version="0" who="admin" reason="Backup 1" I.timestmp="1247146780" I.id="1"/> -D <date>: For modifying the date format. For example, if you replace <date> with %D for the format, the time stamp is displayed as 07/14/09 rather than 2009-07-14_11-52-56. For possible options, see strftime(3C). -F <fmt>: For specifying what template information is displayed. By default, the following information is displayed.
Replace <fmt> with one or more of these options. Individual options are enclosed with ${ }$ and separated from other options with a comma. The entire string is enclosed in single quotes. For example: -F '${id}$,${reason}$' This string would print out the following: 1,Basic test rules for session closure |
restore -n <id> |
Restores the command control database to the select version. Replace <id> with the version number you want to restore. The current configuration is overwritten. You cannot restore when transactions are enabled (see Section 5.4, Command Control Transactions). |
delcfg -n <id> |
Deletes the selected backup from the list. Replace <id> with the version number you want to delete. Deleting a backup is permanent and cannot be undone. |
backup --? |
Displays the usage help for the backup command. |
listcfg --? |
Displays the usage help for the list command. |
restore --? |
Displays the usage help for the restore command. |
delcfg --? |
Displays the usage help for the delete command. |
To back up the database:
./unifi -n cmdctrl backup -t “Added the ls command.”
To restore the second backup in the list:
./unifi -n cmdctrl restore -n 2
The test suite options allow you to run part or all of the Command Control test suites.
Syntax: ./unifi -n cmdctrl runTest [option]
If you have not mapped your local account to a Framework Manager user (see Modify User: Native Maps), replace the -n option with -u <username> -p <password> options and specify the name and password of a Framework Manager user who has the rights to perform this task.
Replace [option] with one or more of the following:
Option |
Description |
---|---|
-t <‘arg’> |
Specifies a specific test suite to run. Replace <arg> with the name of the test suite. This option cannot be used with the -A option |
-A |
Runs all the test suites. This option cannot be used with the -t option. |
-v |
Outputs the full debug information to the screen. |
-V <file> |
Outputs the full debug information to the specified file or the specified path and file. |
-o <file> |
Outputs the test results to the specified file or the specified path and file. |
For example:
./unifi -u admin cmdctrl runTest -A -o /tmp/test.log
This command writes the results of the test suites to the test.log file in the /tmp directory.